1
lilixiang999 2014 年 11 月 24 日
|
2
tommark OP @lilixiang999 这个是自己创建了一个json文件,然后写出去,想问一下怎么让scrapy的 JsonLinesItemExporter自己能输出utf-8的中文
|
3
Jordan 2014 年 11 月 24 日
自己动手丰衣足食,尝试搜索一下源码,找到json.dump()或者json.dumps()调用,加上ensure_ascii=False
|
4
lilixiang999 2014 年 11 月 24 日 我是在pipeline 调用JsonItemExporter方法的时候传递ensure_ascii=False就ok了,http://segmentfault.com/q/1010000000367894
|
5
caoyujia2000 2016 年 11 月 22 日
遇到同样的问题,楼上的方法正解
def spider_opened(self, spider): self.file = open('date.json', 'wb') self.exporter = JsonItemExporter(self.file,ensure_ascii=False) self.exporter.start_exporting() |