再debug状态下,调试时候有时候会显示中文,有时候就会显示unicode 字符编码
比如我定义一类,类里面定义返回类unicode。
def __unicode__(self):
return self.name
但是我在设置成这样:
s=u"你好"
再debug状态下就会显示成unicode字符编码,不会显示成中文。很不方便啊。
求教这个问题如何解决。
阿神2017-04-17 11:30:12
我测试的代码是:
#coding: utf-8
s = u"你好"
print(s)
显示没有问题
osx 10.8 PyCharm 2.7.1 Python 2.7
lz如果你用的是Windows 下,默认是GBK 编码,你把unicode 转换成GBK 试试能不能正常显示?