python - 我如何在 python scrapy 中获取这个数字
问题描述
我的代码:
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:[]
解决方案
试试这个功能:
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
推荐阅读
- unity3d - 使用 DirectShow 枚举视频捕获设备在控制台中效果很好,但不适用于 Unity (2018.2.12)
- asynchronous - Julia @distributed:后续代码在所有工作人员完成之前运行
- docker - docker容器中的高效svn结帐
- dbus - gdbus introspect 与 --recurse 和 --xml 选项一起不递归
- grep - grep - 从字符串中获取单词
- javascript - Mongoose 5.3,this.getUpdate 不是函数
- html - CSS 定位无序列表中的顶级 p 标签
- typescript - 基于 Koa 使用默认和命名导出创建可扩展的打字稿包
- c - 如何从 C 中的链表构建霍夫曼树?
- c# - LINQ To Entities - M 到 M 选择返回比需要更多的列