Python: Convert Hexadecimal to Decimal

In this tutorial, we will introduce how to convert hexadecimal to decimal in python.

Python: Convert Hexadecimal to Decimal

We can use int() function to convert. Here is an example:

s = '0xffa'
print(int(s,16))

Run this code, you will get a decimal number: 4090