I have a line like this: b'\\u0417\\u0434\\u0440\\u0430'
How to decode it? Utf-8 encoding.
PS this is a string, not bytes
I have a line like this: b'\\u0417\\u0434\\u0440\\u0430'
How to decode it? Utf-8 encoding.
PS this is a string, not bytes
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
As noted in the commentary Timur Valiev , the solution of a similar problem is described here . In your case, do this:
>>>> string = "b'\\u0417\\u0434\\u0440\\u0430'" >>>> print(string[2:-1].encode('utf-8').decode('unicode-escape')) Здра Source: https://ru.stackoverflow.com/questions/604027/
All Articles
print(type(data))andprint(ascii(data)). Where did the data come from? (if this is part of json, then you don't need to parse your hands, use json-parser) - jfs