Printing bytes produces different output than printing string
- string
- bytes
- python3
A bytestring is an array of bytes with no particular meaning. Printing bytes prints a represenetation of the array with the b
prefix. Escapes are still present and line breaks don’t matter.
Assuming they represent text, decode the bytes to a string for output.
data = b'test\nbreak'
print(data)
print(data.decode('utf8'))