Aug-11-2021, 02:06 PM
The provided example could not work because the quoting is missing.
import binascii from_your_post = "d8 59 80 a2 c8 be f4 92".replace(" ","") # unhexlify can not handle whitespaces, so I've replaced them with nothing raw_bytes = binascii.unhexlify(from_your_post) # iterating over bytes -> you get integers (0-255, one Byte) back # accessing an index on raw bytes also return an int # consuming raw_bytes with a list, tuple or other sequence types, will also make integers # but accessing a range of bytes, will still return raw bytes # the bytes type in Python is a hybrid. for value in raw_bytes: print(value, type(value))To keep the values, you can append them to a list or consume the raw_bytes with a list:
integers = list(raw_bytes) print(integers)
Output:[216, 89, 128, 162, 200, 190, 244, 146]
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!