文件声明为utf-8编码保存的源文件,但是中文windows的本地默认编码是cp936(gbk编码),Windows中直接打印utf-8的字符串是乱码。
解决方法:

在控制台打印的地方用一个转码就可以
print str.decode('UTF-8').encode('GBK')

1:  #coding:utf-8
2:  '''
3:  Created on 2012-11-1
4:  
5:  @author: Administrator
6:  '''
7:  ff=raw_input('输入:')
8:  print ff.decode('utf-8').encode('gbk')

相关文章:

  • 2021-11-30
  • 2021-11-30
  • 2021-11-30
  • 2021-09-12
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2021-11-30
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案