Python Convert \u String to Text – Python Tutorial

By | October 18, 2023

We may get some string as follows:

text = "\u5bf9\u8bdd\u65f6\u95f4\uff1a2023-4-4 10:32:17\n\u5ea7\u5e2d\uff1a\u60a8\u597d\uff0c

How to convert this kind of string to text in python?

Here we will give you an example:

text = "\u5bf9\u8bdd\u65f6\u95f4\uff1a2023-4-4 10:32:17\n\u5ea7\u5e2d\uff1a\u60a8\u597d\uff0c"
text = text.encode("utf-8").decode('utf-8')
print(text)