Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

String In python with my unicode?

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'
>>> 

What the problem with my unicode string?

Answer*

Draft saved
Draft discarded
Cancel
3
  • still not clean .Could you more clear explain ? thanks Brandon Craig Rhodes Commented Mar 26, 2011 at 21:05
  • I have added another paragraph, and some code samples — do those make it any clearer? Commented Mar 26, 2011 at 21:09
  • Now it's clear .I understand right now from your example ,thank you so much @Brandon Craig Rhodes Commented Mar 26, 2011 at 21:12

lang-py

AltStyle によって変換されたページ (->オリジナル) /