python converting hex binary byte code example
Example 1: hex to binary python3
my_hexdata = "1a"
scale = 16 ## equals to hexadecimal
num_of_bits = 8
bin(int(my_hexdata, scale))[2:].zfill(num_of_bits)
Example 2: bytearray to hex python
''.join('{:02x}'.format(x) for x in StringToBeConverted)