快捷导航

bs4报错 html5lib. Do you need to install a parser library?

获取html内容字符串,进行分析with open('bs1.html',encoding='utf8') as f:    html_doc = f.read()# 导入 BeautifulSoupfrom bs4 import BeautifulSoup# 指定用html5lib来解析html文档soup = BeautifulSoup(html_doc, "html5lib")# 获取html内容字符串,进行分析with open('bs1.html',encoding='utf8') as f:    html_doc = f.read()# 导入 BeautifulSoupfrom bs4 import BeautifulSoup# 指定用html5lib来解析html文档soup = BeautifulSoup(html_doc, "html5lib")
报错:bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?

免责声明:本内容仅代表回答者见解不代表本站观点,请谨慎对待。

版权声明:作者保留权利,不代表本站立场。

回复

使用道具 举报

参与会员1

#可以用这个库进行解析#当然如果你安装了lxml也可以用lxml,解析节点比较快soup=BeautifulSoup(html_cont,'html.parser',from_encoding='utf-8')
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP