xpath
//input[@id='search_input']
//div/ul[@class='lg_tnav_wrap']/li[1]/a
//div/ul[@class='lg_tnav_wrap']/li[1]/a[@*]
lxml
etree
parser
from lxml import etree
html=etree.HTML(text)
parser=etree.HTMLParser(encoding='utf-8')
html=etree.parse('d:/tmp/1223.html',parser=parser)
print(etree.tostring(html,encoding='utf-8').decode('utf-8'))
网友评论