scrapy爬虫,里面用到一个正则表达式,有如下错误信息,麻烦看一下是怎么的?
爬虫代码:
def parseContent(self, response):
for sel in response.xpath('//p[@class="lefcon"]'):
item = NovelspiderItem()
content=sel.xpath('p[3]/p/p/text()').extract()
item['content'] = re.search("正文:(.*?)
错误信息:
File "D:\novelspider\novelspider\spiders\novspider.py", line 62, in parseContent
item['content'] = re.search("正文:(.*?)
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
extract返回值为list,请用.extract()[0]