I tried reading from a file where numbers are stored as 16-bit signed integers in big-endian format.
I used the decompression to read in the number, but for a 16-bit signed integer in big-endian format there is no parameter, only for an unsigned integer. Here is what I still have:
number = f.read(2).unpack('s')[0]
Is there a way to interpret the number above as a signed integer or another way to achieve what I want?
source
share