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