python爬虫正则表达式问题,python爬虫,scrapy爬虫,里面用
python爬虫正则表达式问题,python爬虫,scrapy爬虫,里面用
scrapy爬虫,里面用到一个正则表达式,有如下错误信息,麻烦看一下是怎么的?
爬虫代码:
def parseContent(self, response): for sel in response.xpath('//div[@class="lefcon"]'): item = NovelspiderItem() content=sel.xpath('div[3]/div/p/text()').extract() item['content'] = re.search("正文:(.*?)</p",content,re.S).group(1) yield item
错误信息:
File "D:\novelspider\novelspider\spiders\novspider.py", line 62, in parseContent item['content'] = re.search("正文:(.*?)</p",content,re.S).group(1) File "C:\Python27\lib\re.py", line 146, in search return _compile(pattern, flags).search(string)TypeError: expected string or buffer
编橙之家文章,
相关内容
- Python通过SMTP发送邮件总是验证失败。,pythonsmtp,以下是
- flask问题。,flask问题,http://www.p
- python正则表达式怎么匹配这段中文?,,下面这段文字,
- 如何处理ajax的session一致问题?,处理ajaxsession,我现在
- Windows 下 Pycharm 的正确编码设置?,windowspycharm,在 Pyc
- 微信公众号接入url验证返回"ret":-302,"err_msg":"v
- python菜鸟求助,使用matplotlib 绘制contour等高线图,z为
- 有没有满足如下要求的优先队列推荐,满足如下优先队
- 为什么用 YCM 补全 python 无法补全第三方库?,ycmpytho
- python里面声明多个变量 a = b = c = 1 这样有问题吗,pyt
评论关闭