Python Crawler的JSON输出编码问题

无论爬取时是否进行解码与编码,最终作如下处理便可解决乱码的问题:

 

import codecs
json_output=json.dumps(text_content,ensure_ascii=False,indent=4) jsonfile = 'output.json' j =codecs.open(jsonfile,'w','utf-8') j.write(json_output) j.close()

 

posted on 2013-04-30 16:51  0x9801  阅读(123)  评论(0)    收藏  举报

导航