中文路径读取乱码,json乱码

strPath = 'E:\新建文件夹' #含有中文的路径,使用unicode函数转换. 
strPath = unicode(strPath , "utf8")

 

参考:http://blog.csdn.net/qingyuanluofeng/article/details/49021711

 

 

json中文乱码

 

 

开头加上: 
import sys 
reload(sys) 
sys.setdefaultencoding( "utf-8" )

 

Python转json时: 
josn_rcms = json.dumps(list_rcms,ensure_ascii=False)

 

 

posted on 2017-12-08 15:25  willaty  阅读(283)  评论(0编辑  收藏  举报

导航