源码文件的编码格式为utf-8,但是window的本地默认编码是gbk,所以在控制台直接打印utf-8的字符串当然是乱码了!
import sys
type = sys.getfilesystemencoding()
print mystr.decode('utf-8').encode(type)
源码文件的编码格式为utf-8,但是window的本地默认编码是gbk,所以在控制台直接打印utf-8的字符串当然是乱码了!
import sys
type = sys.getfilesystemencoding()
print mystr.decode('utf-8').encode(type)
转载于:https://my.oschina.net/u/858272/blog/713911