How to Convert Bytes to a String in Python


If you need to convert bytes to a string in Python, then you can do the following:

your_string = b'This works \xE2\x9C\x85'.decode("utf-8")
print(your_string)

Output:

This works ✅

Note that in the above example, we have converted a utf-8 string to.