python's method of converting unicode to str

  • 2020-06-07 04:41:27
  • OfStack

Question:

Convert u'\u810f\u4e71' to '\u810f\u4e71'

Methods:


s_unicode = u'\u810f\u4e71' 
s_str = s_unicode.encode('unicode-escape').decode('string_escape')  

Related articles: