Byte array as hex string
Posted: Sun Oct 01, 2017 12:29 pm
I have a byte array and when I print it, certain bytes are shown with ascii characters.
eg. bytearray(b'hello')
I'm trying to get it to display as bytearray(b'\x68\x65\x6c\x6c\x6f')
Is there a way to print it showing each byte in hex \xNN format?
eg. bytearray(b'hello')
I'm trying to get it to display as bytearray(b'\x68\x65\x6c\x6c\x6f')
Is there a way to print it showing each byte in hex \xNN format?