Hex String

Chris Rebert clp2 at rebertia.com
Mon May 10 16:15:05 EDT 2010


On Mon, May 10, 2010 at 12:55 PM, Anthony Cole <anthony.cole at gmail.com> 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!

I think you want the `struct` module:
struct — Interpret strings as packed binary data
http://docs.python.org/library/struct.html

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list