Convert hex string to int in Python
Without the 0x prefix, you need to specify the base explicitly, otherwise there’s no way to tell: With the 0x prefix, Python can distinguish hex and decimal automatically. (You must specify 0 as the base in order to invoke this prefix-guessing behavior; if you omit the second parameter int() will assume base-10.)