首页 > 解决方案 > 我如何在 python scrapy 中获取这个数字

问题描述

css的照片

我的代码:

def parse(self, response):
    score = response.css('div.twoRowExtra')

    for match in match:

        score1 = score.css('div.livescore.twoRowExtraRow:first-child span::text').extract()

        items['score1'] = score1


        yield items

总是响应是 score1:[]

标签: pythonscrapy

解决方案


试试这个功能:

def parse(self, response):
    score = response.css('div.twoRowExtra')

    for match in score:
        score1 = match.css('div.livescore.twoRowExtraRow:first-childspan::text').extract()
        items['score1'] = score1
        yield items

推荐阅读