If you want to convert bytes to string in Python, then you may use multiple ways of doing that. In this article, we are going to look at few methods.
Consider this example –
bytes_string = b'Ironman'
print(bytes_string.decode('utf-8'))
PythonCopy
In this code, I am using decode
function with utf-8
encoding to convert bytes of Ironman
back to string.
#python #python bytes #python string #python-short