Loading

学习情况记录 13 报错:TypeError: object of type 'Response' has no len()

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")
posted @ 2020-02-13 21:06  李旭2018  阅读(154)  评论(0编辑  收藏  举报