xpath helper 里面能定位数据,但是程序无法打印出来

import re,requests
from fake_useragent import  UserAgent
import parsel


url="https://www.ccbfutures.com/main/research/research_report/daily_paper/index.shtml"
headers={
    "User-Agent":UserAgent().chrome
}
response=requests.get(url=url,headers=headers)
select=parsel.Selector(response.text)
result_list=select.xpath('//li')
# print(result_list)
for result in result_list:
    href=result.xpath('//div[@class="imp_news clearfix"]/ul/li/a/@href').get()
    time=result.xpath('//li/span[@class="time"]').get()
    title=result.xpath('//div[@class="imp_news clearfix"]/ul/li/a/text()').get()
    print(href,time,title)

 

 

查看全部
qq_31993885
qq_31993885
2020/11/25 00:19
  • python
  • 点赞
  • 收藏
  • 回答
    私信

1个回复