DEV Community

Max Angelo Perin (ᜋᜃᜐ)
Max Angelo Perin (ᜋᜃᜐ)

Posted on

Answer: How do I convert a Python 3 byte-string variable into a regular string?

You had it nearly right in the last line. You want

str(bytes_string, 'utf-8')

because the type of bytes_string is bytes, the same as the type of b'abc'.

Discussion (0)