一生热爱回头太难
2021-01-27 21:04Python用xpath爬取数据返回空列表是什么原因?
import requests
from lxml import etree
def getlist():
url='https://www.biquge5200.com/82_82590/173359438.html'
response = requests.get(url).texe
tree = etree.HTML(response)
nove = tree.xpath('//*[@id="content"]/p/text()')
title = tree.xpath('//*[@id="wrapper"]/div[4]/div/div[2]/h1/text()')
print(title)
getlist()
返回的是[ ]。
是什么原因。
- 点赞
- 回答
- 收藏
- 复制链接分享
4条回答
为你推荐
- 【scrapy爬虫问题】scrapy.xpath解析返回的结果有问题,求解答!!!
- python
- 1个回答
- python 爬取表格 获取不到数据
- python
- 4个回答
- python爬虫中用xpath总是获取不到内容,希望大家帮我看看这两个网页中所需内容如何定位?谢谢~
- python
- 2个回答