I'm trying to make a GIF analyzer; I'm having problems with reading an arbitrary number of bits as an integer in little endian. Struct is nice for byte-sized arguments, but some of the GIF structures are 3 bit little endian unsigned integers (specifically in the GIF header, http://www.onicos.com/staff/iz/formats/gif.html). what's the best way to invert these numbers?
I have tried reversing the endianness of the entire byte/s with Struct but it doesn't want to invert:
struct.unpack('<'+str(len(string))+'s',string)[0] //does not actually invert