报错的程序:
content = bs4.BeautifulSoup(response.content.decode("utf-8"), "lxml")报错如下:
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
报错原因:版本语法错误,lxml改成html.parser即可。
修改后程序:
content = bs4.BeautifulSoup(response.content.decode("utf-8"), 'html.parser')
本文介绍了一种常见的BeautifulSoup解析网页内容时遇到的错误——找不到lxml解析器,并提供了解决方案,即将lxml替换为html.parser。
1万+

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



