3 byte network ordered int, How To ?

Matthew Barnett mrabarnett at mrabarnett.plus.com
Wed Jan 6 13:33:19 EST 2010


mudit tuli wrote:
> For a single byte, struct.pack('<B',<int>)
> For two bytes, struct.pack('<H',<int>)
> what if I want three bytes ?
> 
Four bytes and then discard the most-significant byte:

struct.pack('<I', <int>)[ : -1]



More information about the Python-list mailing list