学习情况记录 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")