This. You shouldn't have to go around twiddling with bits in python unless whomever designed your protocol is insane (stuff like bitfields where part of the bitfield actually represents an integer or whatever). Unpack will do it for you and give you a nice, pretty python integer, and pack will do the reverse (if you have to send datagrams back).Izmunuti":2qoc3k99 said:x, y = unpack('<l<l', data);
They're both in the struct package.
(I have a nice little rule about Python... if I want to do it, it's almost always in the standard library.