1.检查代码问题
soup =BeautifulSoup(html,"html.parser")
2.先用pip uninstall lxml卸载,再用pip install lxml安装,
3.先用pip3 uninstall lxml卸载,再用pip3 install lxml安装
- 2或3,查看报错问题
本文解决使用BeautifulSoup解析HTML时遇到的问题,详细介绍了如何通过正确安装lxml来确保代码正常运行。首先检查代码中BeautifulSoup的使用是否正确,然后提供了两种重新安装lxml的方法,包括使用pip和pip3进行卸载与安装。
1.检查代码问题
soup =BeautifulSoup(html,"html.parser")
2.先用pip uninstall lxml卸载,再用pip install lxml安装,
3.先用pip3 uninstall lxml卸载,再用pip3 install lxml安装
1660
3万+
3870
263
2678
281
348
2万+
1268

被折叠的 条评论
为什么被折叠?