pack a three byte int

p.lavarre at ieee.org p.lavarre at ieee.org
Thu Nov 9 20:24:15 EST 2006


Perhaps Python can't concisely say three-byte int ...

But Python can say six-nybble hex:

>>> import binascii
>>> cdb = binascii.unhexlify('%02X%06X%02X%02X' % (0x08, 0x12345, 0x80, 0))
>>> binascii.hexlify(cdb)
'080123458000'
>>>

Thanks again for patiently helping me find this.  A shortcut is:

http://docs.python.org/lib/genindex.html
search: hex




More information about the Python-list mailing list