scrapy出现:AttributeError: 'list' object has no attribute 'xpath'
2017-02-26 21:30
1151 查看
这个问题一般是我们在取出多个连接的时候加上了.extract()
如(错误):
正确应该去掉:
如(错误):
chaps = response.xpath('//*[@class="mulu_list"]//a').extract() for i in range(len(chaps)): list = ListItem() list['chapName'] = chaps.xpath('text()').extract()[i] list['chapUrl'] = chaps.xpath('@href').extract()[i] yield list
正确应该去掉:
chaps = response.xpath('//*[@class="mulu_list"]//a')
相关文章推荐
- scrapy:使用response.follow()方法时出现AttributeError: 'HtmlResponse' object has no attribute 'follow'
- python 中出现的AttributeError: 'module' object has no attribute '_handlerList'
- Scrapy安装报错:AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'解决办法
- Python连接字符串,join出现问题:python 'list' object has no attribute
- 出现错误如下:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
- Scrapy报错Error: 'module' object has no attribute 'OP_SINGLE_ECDH_USE'
- Scrapy抓取数据循环报AttributeError: 'str' object has no attribute 'css'
- 部署爬虫到scrapy cloud上出现'_sre.SRE_Match' object has no attribute '__getitem__'的错误
- Ubuntu16.04上启动Spyder出现错误AttributeError: 'module' object has no attribute '_base'
- 配置SSD-caffe出现“ AttributeError: 'module' object has no attribute 'LabelMap'”解决
- sqlalchemy enum AttributeError: 'list' object has no attribute 'replace'
- AttributeError: type object '_socketobject' has no attribute 'socket'
- AttributeError: 'module' object has no attribute 'imsave'
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- AttributeError: module object has no attribute “Series”. Code works in Python
- Python错误AttributeError: 'module' object has no attribute 'copy'
- AttributeError: '_csv.reader' object has no attribute 'next'
- openerp.cli.main() AttributeError: 'module' object has no attribute 'cli'
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法