编码格式太混乱了,记录一下,原来getdefaultencoding不是全局编码····
print (sys.getdefaultencoding() ) #Python环境系统默认编码 解释器会用到
print( sys.getfilesystemencoding()) #文件编码
print (locale.getdefaultlocale() )#操作系统当前编码 是getpreferredencoding的父集
print (sys.stdin.encoding )#输入编码 input()会用到
print (sys.stdout.encoding )#输出编码 print()会用到
我的输出结果:
utf-8
utf-8
(‘zh_CN’, ‘cp936’)
cp936
UTF-8