
Lv.1
烧黑了的萌新
签名:正在吸猫
在 【Python作品分享】新的作品【教程贴】 中回复
判断的地方可以简化成
if not bool(year%400) or not bool(year%4):2020-05-10T21:55:20 点赞:0
在 在进行python字符图形转换时不能在cmd里面安装pip install pillow 中回复
解决方案:
将python安装目录下的scripts文件夹的路径添加进系统环境变量,如果没有效果可尝试重启您的计算机
2020-05-11T21:11:03 点赞:0
在 【爬虫必备】编程猫社区的API 中回复
写了一个获取pid的函数,利用正则提取pid(pid居然藏在页面的代码里)
import re
import requests
def get_pid():
url = 'https://shequ.codemao.cn'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW喵) AppleWebKit/537.17 (KH喵L, like Gecko) Chrome/24.0.1312.60 Safari/537.17'}
req = requests.get(url, headers=headers)
return re.findall(re.compile(r'<script title\s*?=\s*?inject_config\s*?>[\s\S]*?[\'\"]pid[\'\"]\s*?:\s*?[\'\"](\w+)[\'\"][\s\S]*?</script>'), req.text)[0]2020-05-12T19:02:41 点赞:0