鱼C论坛's Archiver
论坛
›
Python交流
› lxml 库 查看源文档(是叫DOM树?!)
wp231957
发表于 2021-6-4 09:46:46
lxml 库 查看源文档(是叫DOM树?!)
res=requests.get(url,headers=headers)
res.encoding="gb2312"
tree = etree.HTML(res.text)
print(etree.tostring(tree,encoding="gb2312" ,pretty_print=True).decode("gb2312"))
页:
[1]
查看完整版本:
lxml 库 查看源文档(是叫DOM树?!)