xxxxxxxxxx
# utf-8 is used here because it is a very common encoding, but you
# need to use the encoding your data is actually in.
bytes = b'abcde'
bytes.decode("utf-8")
'abcde'
xxxxxxxxxx
# Assuming the byte array contains UTF-8 encoded text
byte_array = b'Hello, World!'
string = byte_array.decode('utf-8')
print(string)