Reading hex to int from a binary string

Luc luc.traonmilin at gmail.com
Thu Oct 8 16:46:14 EDT 2009


Hi all,

I read data from a binary stream, so I get hex values as characters
(in a string) with escaped x, like "\x05\x88", instead of 0x05.

I am looking for a clean way to add these two values and turn them
into an integer, knowing that calling int() with base 16 throws an
invalid literal exception.

Any help appreciated, thanks.



More information about the Python-list mailing list