学习情况记录 13

TypeError: object of type 'Response' has no len()

r = requests.get(url)
r.encoding = "utf-8"
soup = BeautifulSoup(r, "html.parser")

产生报错

出现错误的原因是因为这里的wb_data是requests对象,无法用BeautifulSoup解析,可以在wb_data后面加上content

soup = BeautifulSoup(r.content, "html.parser")

猜你喜欢

转载自www.cnblogs.com/lixv2018/p/12305229.html