You can convert hex string into an int in Python by following ways:-
You must put ‘0x’ prefix with hex string, it will specify the base explicitly, otherwise, there's no way to tell:
x = int("fff", 16)
print int("0xfff", 0)
print int("10", 0)
It is necessary to specify 0 as the base in order to invoke this prefix-guessing behavior; if you omit the second parameter then it will assume base as -10.
If you do not want to put 0x prefix then you can do by following way:-
int(hexString, 16) is used and it works with and without the 0x prefix.
If you wish to learn more about Python, visit the Python tutorial and Python course by Intellipaat.