Nadav Samet wrote: > Hi, > > I am trying to unpack a 32-bit unsigned integer from a string using > struct.unpack. > 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?
Looking into the docs, prepending your format string with "=" should make "L" exactly 32 bits on each platform. Georg -- http://mail.python.org/mailman/listinfo/python-list