Hex String

MRAB python at mrabarnett.plus.com
Mon May 10 16:15:20 EDT 2010


Anthony Cole wrote:
> How can I concatenate 2 hex strings (e.g. '\x16' and '\xb9') then convert 
> the answer to an integer?
> 
> When I try i always end up with the ASCII equivalent!
> 
Those are just bytestrings (assuming you're using Python 2.x), ie
strings using 1 byte per character. You can convert a bytestring to an
integer using the functions in the 'struct' module.



More information about the Python-list mailing list