I’m using hex(int('00000000', 2)) to convert a binary string into hex.
It works fine for all (output) values from 10 to FF, but its not padding 00 to 09 properly, and I’m seeing 0x0 to 0x9 instead of the 0x00 to 0x09 that I am expecting.
What am I doing wrong?
hex()will return the shortest string possible.One alternative is to simply use: