蟒蛇。字符串的编码

时间:2011-02-19 10:37:26

标签: python

>>> word = '\u041a\u041e\u041b'
>>> print u'\u041a\u041e\u041b' 
КОЛ
>>> print word 
\u041a\u041e\u041b

如何将字符串作为变量转换为 可读类(如何打印字)?

1 个答案:

答案 0 :(得分:6)

>>> print '\u041a\u041e\u041b'.decode('unicode-escape')
КОЛ