Convert bytes into a String in python
I recently needed to convert a bytes object into a readable string format. I found that I could do so very easily using the following method.
Start with a bytes object
str = b'johnwiseman'
Convert bytes to String
You can convert the bytes value into a string value by decoding it into utf-8
str = b'johnwiseman' print str.decode("utf-8")
print str(b'johnwiseman', "utf-8")