2

Possible Duplicate:
Convert hex string to int in Python

Hello, I want to use some string like "0xFF123456" as a 32-bit unsigned integer. Please give me some advice. Thanks.

1

3 Answers 3

5

a = int("0xFF123456", 0)

If it doesn't have a 0x prefix you could also use:

a = int("FF123456", 16)

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! Using zero is what I want.
2
>>> int('0xFF123456', 16)
4279383126
>>> 

Comments

0

try this:

>>>print int("0xFF123456",0)

or

>>>print int("0xFF123456",16)

1 Comment

Thank you! Using zero option is what I want.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.