convert hexadecimal to binary in python code example
Example 1: python convert hex to binary
my_hexdata = "1a"
scale = 16
bin(int(my_hexdata, scale))[2:].zfill(len(my_hexdata)*4)
Example 2: python convert binary / hexadecimal / decimal to binary / hexadecimal / decimal
import coden
ans = coden.bin_to_int(number)
ans = coden.bin_to_hex(number)
ans = coden.hex_to_int(number)
ans = coden.hex_to_bin(number)
ans = coden.int_to_bin(number)
ans = coden.int_to_hex(number)
Example 3: hex to binary python3
my_hexdata = "1a"
scale = 16
num_of_bits = 8
bin(int(my_hexdata, scale))[2:].zfill(num_of_bits)