Skip to content Skip to sidebar Skip to footer

Python Decode "\u041b" String

I have unicode string, i'm sure that it's UTF-8, but I can't decode it. The string is '\u041b\u0435\u0433\u043a\u043e\u0432\u044b\u0435'. How to decode it?

Solution 1:

You can use aString.decode('unicode_escape'), it convert a unicode-format string to unicode object

>>> u'\u041b\u0435\u0433\u043a\u043e\u0432\u044b\u0435'u'\u041b\u0435\u0433\u043a\u043e\u0432\u044b\u0435'>>> '\u041b\u0435\u0433\u043a\u043e\u0432\u044b\u0435'.decode('unicode_escape')
u'\u041b\u0435\u0433\u043a\u043e\u0432\u044b\u0435'
>>>

In your case

>>>print'\u041b\u0435\u0433\u043a\u043e\u0432\u044b\u0435'.decode('unicode_escape')
Легковые
>>>

Post a Comment for "Python Decode "\u041b" String"