import lxml
import lxml.etree
html = lxml.etree.parse("index.html")
print(type(html))
res = html.xpath("//li")
print(len(res), type(res))
print(type(res[0]))
print(html.xpath("//li/@class"))
print(html.xpath("//li/@text"))
print(html.xpath("//li/a"))
print(html.xpath("//li/a/@href"))
print(html.xpath("//li/a/@href=\"link3.html\""))
print(html.xpath("//li//span"))
print(html.xpath("//li//span/@class"))
print(html.xpath("//li/a//@class"))
print(html.xpath("//li"))
print(html.xpath("//li[1]"))
print(html.xpath("//li[last()]"))
print(html.xpath("//li[last()-1]"))
print(html.xpath("//li[last()-1]/a/@href"))
print(html.xpath("//*[@text=\"3\"]"))
print(html.xpath("//*[@text=\"3\"]/@class"))
print(html.xpath("//*[@class=\"nimei\"]"))
print(html.xpath("//li/a/text()"))
print(html.xpath("//li[3]/a/span/text()"))