报错:

Traceback (most recent call last):

  File "/Users/q/Desktop/python/python16.py", line 40, in <module>

    b=re.findall(".*>系统要求(.*)</p>.*",response)

  File
"/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py",
line 241, in findall

    return _compile(pattern, flags).findall(string)

TypeError: expected string or bytes-like object

 

究其原因:

re.findall()第二个参数需要字符串类型,但是response的返回值不是字符串,需要str()转换一下。

修改:

b=re.findall(".*>系统要求(.*)</p>.*",str(response))

技术
今日推荐
PPT
阅读数 135
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信