在用parse的时候出现报错,这时候要自己调参数。
from lxml import etree parser=etree.HTMLParser(encoding="utf-8") html=etree.parse(‘flower.html‘,parser=parser) result=etree.tostring(html) print(result)
lxml库使用parse函数
原文:https://www.cnblogs.com/ZQUACM-875180305/p/9471581.html