python下eclipse中接收中文后输出显示乱码问题,代码如图所示。

如题所述

第1个回答  2017-11-16

代码没问题, 估计是eclipse配置的问题, 没用它写过python,一直都要pycharm的

Python 2.7.13 (default, Jan 19 2017, 14:48:08) 
[GCC 6.3.0 20170118] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = raw_input()
阿斯蒂芬
>>> print 'name', s
name 阿斯蒂芬
>>> print s.decode('utf8')
阿斯蒂芬
>>>

第2个回答  2013-05-03
from struct import *
# 把你这上面代码加上去
print unpack('30b', pack('30s', s))

把这两行代码加上,看看会有什么效果,结果粘贴出来看看。追问

不行的啊

追答

不行是个什么情况?什么不行?

第3个回答  2013-05-03
你改成 print s试试,编码问题,python内部是ascii追问

不行的哦

追答

print s.decode('utf-8').encode('gb2312')

追问

不行 这个我刚开始就试过了

相似回答