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

Return to Revisions

3 of 3
edited tags
Daniel Imms
  • 50.6k
  • 19
  • 157
  • 170

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?

tree em
  • 22k
  • 30
  • 98
  • 136
lang-py

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