my_hexdata = "1a"
scale = 16 # equal to hexadecimal
bin(int(my_hexdata, scale))[2:].zfill(len(my_hexdata)*4)
# By changing the parameter of the zfill function we allow for any length of
# hexadecimal code, which is more useful when using this code.
# Convert to Other Number Systems : Binary, Hex, Oct
#input >>
i = 12
# convertion
print("Binary: " + str(bin(i)))
print("Octal: " + str(oct(i)))
print("Hex: " + str(hex(i)))
# output >>
# Binary: 0b1100
# Octal: 0o14
# Hex: 0xc