Convert decimal to hexadecimal in Python
Advertisements
We can use hex()
to convert a given decimal number into its hexadecimal equivalent.
print(hex(1)) #0x1 print(hex(22)) #0x16 print(hex(2312)) #0x908