hex string to hex number 1

hex string to hex number

hex_s = '0xEFA'
a = int(hex_s,16)
hex_n = hex(a)
print(hex_n)

Here is what the above code is Doing:
1. hex_s is a string that contains a hexadecimal number.
2. int(hex_s,16) converts hex_s to an integer.
3. hex(a) converts a to a hexadecimal string.

Similar Posts