Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> str_version = 'នយោបាយ'
>>> type(str_version)
<class 'str'>
>>> print (str_version)
នយោបាយ
>>> unicode_version = 'នយោបាយ'.decode('utf-8')
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
unicode_version = 'នយោបាយ'.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
>>>
我的unicode字符串有什么问题?字符串在Python与我的Unicode?
还不干净。你能更清楚地解释一下吗?感谢布兰登克雷格罗德斯 – kn3l 2011-03-26 21:05:23
我已经添加了另一段和一些代码示例 - 这些使它更清晰吗? – 2011-03-26 21:09:17
现在很明显,我现在明白你的例子,非常感谢你@Brandon Craig Rhodes – kn3l 2011-03-26 21:12:13