I want to calculate the number of digits in hex number in python for example:
num = 0X0101
num1 = 0X00001
print(len(format(num, "04x")))
the problem is the number of digits and the leading zeros are variable so this line will not work.
print(len(format(num, "04x")))
Note that num and num1 are just an example and could have a different values.
I want to calculate the number of digits in hex number without removing the leading zeros.