python 乱码

在中文 windows平台下:

#coding:utf-8

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

 文件编码为 utf-8

posted @ 2011-08-21 12:00  庚武  Views(185)  Comments(0Edit  收藏  举报