使用html5lib 出現解析錯誤
2019/12/03 下午 07:06
Python網路爬蟲討論版
林建宏
觀看數:3
回答數:2
收藏數:1
pycrawler
pycrawler-d08
soup = BeautifulSoup(r.text, "html5lib")
回傳錯誤訊息
FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?
是為什麼呢?執行前有!pip install html5lib
回答列表
-
2019/12/03 下午 09:31Jeffrey贊同數:1不贊同數:0留言數:0
Use 'html.parser' instead of 'html5lib'.
-
2019/12/03 下午 10:07張維元 (WeiYuan)贊同數:1不贊同數:0留言數:1
你的 Python 版本是什麼,建議試試看 html.parser (不用 pip 安裝)跟 lxml(需要 pip 安裝)能不能用。