现在的位置: 首页 > 综合 > 正文

python 乱码

2012年11月06日 ⁄ 综合 ⁄ 共 108字 ⁄ 字号 评论关闭

在中文 windows平台下:

#coding:utf-8

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

 文件编码为 utf-8

抱歉!评论已关闭.