lxml xpath用法

from lxml import  etree
import requests
hed={
   "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
}
resp=requests.get("https://movie.douban.com/",headers=hed)
# print(resp.text)
et=etree.HTML(resp.text)
result=et.xpath("//div/a/@href")
result=et.xpath("//div/a/text()")
print(result)

lxml xpath用法

 

上一篇:CF1479C Continuous City 题解


下一篇:开放API接口 USDT快捷接入充提教程