This is a sample of my input:
a = 41cf4a077a7454
They represent hex values, x41 xCF x4A etc...
I require to convert them into one string of binary like this (DESIRED OUTPUT):
01000001110011110100101000000111011110100111010001010100
x41 = 01000001 xCF = 11001111 x4A = 01001010 etc...
The code I used to do it looked like this:
return bin(int(str(a), 16))[2:]
However, it produces a string without a zero at the front:
1000001110011110100101000000111011110100111010001010100
It appears the zero gets chopped as it's interpreted as an integer. Is there a way I can keep the zero, because not every string being converted begins with a zero in binary.
I hope this makes sense. Thank you.