from lxml import etree
with open("tmp/web_code.txt",encoding="utf-8") as f:
web_code = f.read()
dom = etree.HTML(web_code) # 解析网页
dom.xpath("/html/head/title/text()") #获取文章标题
from lxml import etree
with open("tmp/web_code.txt",encoding="utf-8") as f:
web_code = f.read()
dom = etree.HTML(web_code) # 解析网页
dom.xpath("/html/head/title/text()") #获取文章标题