python 乱码

在中文 windows平台下:

#coding:utf-8

str = "hello 我是中国人,我爱中国"
print str       #乱码
print str.decode('utf-8').encode('gbk') 

 文件编码为 utf-8

原文地址:https://www.cnblogs.com/wucg/p/2147741.html