Aug-28-2020, 11:11 AM
(This post was last modified: Aug-28-2020, 11:11 AM by Gribouillis.)
The bytes type is already an array of integers in the range(0, 256).
>>> x = b'B\xda\xed\xc5' >>> list(x) [66, 218, 237, 197]For the conversion to 32 bits integer, you could have a look into the struct module
>>> import struct >>> x = b'B\xda\xed\xc5' >>> struct.unpack('i', x) (-974267838,) >>> struct.unpack('<i', x) (-974267838,) >>> struct.unpack('>i', x) (1121643973,)