I’m trying to unpack structure as shown below in this way to get ‘0123456789’
b"\x10\x32\x54\x76\x98"
Maybe there is other way then writing own function to do so ?
Thanks
>Solution :
I think it’s easier to debug if you use your own function. However, if you want a one line command to turn this into a string you can do like so:
X = b"\x10\x32\x54\x76\x98"
tmp = "".join([hex(i)[:1:-1] for i in X])
print(tmp)
>>> 0123456789
Basically it turns each byte to hexadecimal (which handles splitting methods), so we split them to read them backward without "0x".
Finally we join them using an empty string separator.