scrapy抓取到中文,保存到json文件为unicode解决方法

https://stackoverflow.com/questions/9181214/scrapy-text-encoding 参阅的这里

在settings.py中添加  FEED_EXPORT_ENCODING = 'utf-8' 完美解决

保存为文本的执行命令:scrapy crawl 爬虫名 -O 文件名
支持的文件类型有
'json', 'jsonlines', 'jl', 'csv', 'xml', 'marshal', 'pickle'
例如:scrapy crawl tiantian -O fund50.jaon 执行名叫tiantian的爬虫,保存到fund50.json文件中,-O

--output=FILE, -o FILE                           append scraped items to the end of FILE (use - for stdout)
--overwrite-output=FILE, -O FILE          dump scraped items into FILE, overwriting any existing file

注意要在项目目录下执行
原文地址:https://www.cnblogs.com/shiyongge/p/14315906.html