May I know how to write a Python script to convert binary string to hexadecimal string and keep the leading zeros?
For an example, I have binary string "0000000000001010" and would like to print it into "000A". I know i can use zfill() function, but the number of leading zeros is unknown.