Hex String

A

Anthony Cole

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!

Thanks,
Anthony
 
M

MRAB

Anthony said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top