hex to bin 16 bit word

python w.g.sneddon at gmail.com
Fri Apr 27 14:42:24 EDT 2012


Is there an other way to do this?

What to decode hex '0xC0A8'  and return signed short int.

>>> struct.unpack('>h','\xC0\xA8')
(-16216,)


Above works just wondering if there is cleaner way without writing a
function.

Bill



More information about the Python-list mailing list