中文路径读取乱码,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)
【本文章出自博客园willaty,转载请注明作者出处,误差欢迎指出~】