See Convert bytes to floating point numbers in Python
You probably want to use a structural module like
import struct response = (0, 0, 117, 143, 6) struct.unpack(">I", ''.join([chr(x) for x in response[:-1]]))
Assuming an unsigned int. Perhaps the best way to do the conversion for decompression, understanding the list using a join was the first thing I came up with.
EDIT . See also Ξ€ΞΩ΀ΞΞΞΞ₯ comment on this answer regarding judgment.
EDIT No. 2 . If you don't mind using an array module, this is an alternative method that eliminates the need for list comprehension. Thanks @ JimB , pointing out that unpacking can work on arrays too.
import struct from array import array response = (0, 0, 117, 143, 6) bytes = array('B', response[:-1]) struct.unpack('>I', bytes)
Jay
source share