struct.unpack on 64-bit platforms

Nadav Samet thesamet at
Thu Jun 22 18:30:26 CEST 2006


I am trying to unpack a 32-bit unsigned integer from a string using
so using string.unpack('L', data)  would work fine on 32-bit systems,

But apparently, on 64-bit platforms it tries to read 64-bit unsigned
integer (since
that's what the C Type unsigned long means on 64-bit platforms).

So what's the way to make it read exactly 32-bits, on all platforms?


More information about the Python-list mailing list