使用etree.HTML(),解析网页报错ValueError: can only parse strings
from lxml import etree
html = open("joblist.html")
print(html)
et = etree.HTML(html,parser=etree.HTMLParser(encoding='utf-8'))
在open()后加上.read(),即可解决问题。
from lxml import etree
html = open("joblist.html").read()
print(html)
et = etree.HTML(html,parser=etree.HTMLParser(encoding='utf-8'))
最后
以上就是腼腆冬日最近收集整理的关于报错:ValueError: can only parse strings的全部内容,更多相关报错:ValueError:内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复