Open liliners opened 2 years ago
已经解决了,估计是没注意改动到哪里了
我也是遇到了同样的问题
如何修改呢
我把每个re.findall(r'\d+.',attitudes_count)都改成了re.findall(r'\d+.', str(attitudes_count))就解决了。
THANKS!
我把每个re.findall(r'\d+.',attitudes_count)都改成了re.findall(r'\d+.', str(attitudes_count))就解决了。
感谢,问题解决了
(venv) PS C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\pachong\pachong\weibo-search\weibo\spiders> scrapy crawl search 2022-06-10 10:06:40 [scrapy.core.scraper] ERROR: Spider error processing <GET https://s.weibo.com/weibo?q=%23%E6%96%B0%E5%86%A0%E8%82%BA%E7%82%8E%23&scope=ori&suball=1×cope=custom :2022-05-01-0:2022-05-09-0&display=0&retcode=6102> (referer: None) Traceback (most recent call last): File "C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\venv\lib\site-packages\scrapy\utils\defer.py", line 132, in iter_errback yield next(it) File "C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\venv\lib\site-packages\scrapy\utils\python.py", line 354, in next return next(self.data) File "C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\venv\lib\site-packages\scrapy\utils\python.py", line 354, in next return next(self.data) File "C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\venv\lib\site-packages\scrapy\core\spidermw.py", line 66, in _evaluate_iterable for r in iterable: File "C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\venv\lib\site-packages\scrapy\spidermiddlewares\offsite.py", line 29, in process_spider_output File "C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\pachong\pachong\weibo-search\weibo\spiders\search.py", line 107, in parse for weibo in self.parse_weibo(response): File "C:\Users\lilin\Desktop\weiboyuqing\weiboyuqing\pachong\pachong\weibo-search\weibo\spiders\search.py", line 420, in parse_weibo comments_count = re.findall(r'\d+.*', comments_count) File "D:\Python\lib\re.py", line 239, in findall return _compile(pattern, flags).findall(string) TypeError: expected string or bytes-like object