Search code examples
pythonunicode

Python Unicode string stored as '\u84b8\u6c7d\u5730' in file, how to convert it back to Unicode?


Some Unicode data is stored in file as '\u84b8\u6c7d\u5730' without any encoding.

Is there a way to covert them back in Python?


Solution

  • >>> print '\u84b8\u6c7d\u5730'.decode('unicode-escape')
    蒸汽地