Traceback (most recent call last): File "D:/xiaobaijian/pythonstore/myapp.py/042803.py", line 5, in <module> bs_ob

动态 未结 0 89
小小草
小小草 LV1 2023年9月23日 23:40 发表
这个错误提示是因为在使用BeautifulSoup时,传入了一个不支持的参数`feature`。根据BeautifulSoup官方文档,`feature`参数已经被废弃,应该使用`parser`参数来指定解析器。 例如,如果要使用lxml解析器,可以这样写: ```python from bs4 import BeautifulSoup import requests url = 'http://www.example.com' response = requests.get(url) c = response.content bs_obj = BeautifulSoup(c, parser='lxml') ``` 注意,`parser`参数的取值可以是`'html.parser'`、`'lxml'`、`'xml'`等,具体取决于你安装的解析器。如果没有安装lxml解析器,可以通过`pip install lxml`命令进行安装。
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复