原因分析:
说明:所用版本 beautifulsoup4 4.12.3
写法错误,新版本beautifulsoup4写法改变了
BeautifulSoup(html, 'lxml') 改为 BeautifulSoup(html, 'html.parser')
旧版写法
soup= BeautifulSoup(html, 'lxml')
新版写法
soup= BeautifulSoup(html, 'html.parser')
参考资料
说明:所用版本 beautifulsoup4 4.12.3
写法错误,新版本beautifulsoup4写法改变了
BeautifulSoup(html, 'lxml') 改为 BeautifulSoup(html, 'html.parser')
soup= BeautifulSoup(html, 'lxml')
soup= BeautifulSoup(html, 'html.parser')
参考资料