response = requests.get(url)
# 获取响应内容
response = response.text
# 将响应内容转化为html
selector = etree.HTML(response)
# print(selector)
# 通过路径获取内容
for iin selector.xpath('//tr[@class="t_tr1"]'):
# i.xpath('td/text()'返回的是一个数组
# print(i.xpath('td/text()'))
datetime =int(i.xpath('td/text()')[0])
网友评论