BeautifulSoup4 ---- TypeError:タイプ 'Response'のオブジェクトにlen()がありません



Beautifulsoup4 Typeerror



問題:スクリプトを実行しようとすると、BeautifulSoup(html, ...)エラーメッセージを表示します ' TypeError:タイプ 'Response'のオブジェクトにlen()がありません 。実際のhtmlをパラメーターとして渡してみましたが、それでも機能しません。

url = 'https://www.ximalaya.com/shangye/6855034/' headers={ 'User-Agent':'Mozilla/5.0 (Windows NT 10.0 WOW64 rv:62.0) Gecko/20100101 Firefox/62.0', } html=requests.get(url,headers=headers) html.encoding = 'utf-8' # print(html.text) soup = BeautifulSoup(html.text, 'html.parser') # = BeautifulSoup(html, 'html.parser'), the parameter html is not passed. print(soup.text)
|_+_|