Binary conversion has always been a headache for beginners, the following is a simple list of how each of the binary is converted.
# print (' 2-->8: ', Oct (int (' 0b1010 ', 2)) # 2-10-8# print (' 2-->10: ', int (' 0b1010 ', 2)) # 2-10# print (' 2--& GT;16: ', Hex (int (' 0b1010 ', 2)) # 2-10-16# print (' 8-->2: ', Bin (int (' 0o12 ', 8)) # 8-10-2# print (' 8-->10: ', int (' 0o12 ', 8) # 8-10# print (' 8-->16: ', Hex (int (' 0o12 ', 8))) # 8-10-16# print (' 10-->2 ', bin ) # 10-2# print (' 10-->8 ', Oct (Ten)) # 10-2# print (' 10-->16 ', hex) # 10-16# print (' 16-->2: ', Bin (int (' 0xa ', +)) # 16-10-2# print (' 16-->8: ', Oct (int (' 0xa ', +))) # 16-10-8# print (' 16-->10: ', int (' 0xa ', 16) # 16-10 " 2-->8: 0o12 2-->10:10 2-->16:0xa 8-->2:0b1010 8-- >10:10 8-->16:0xa 10-->2 0b1010 10-->8 0o12 10-->16 0xa 16-->2:0b1010 16-->8:0o12 16-->10:10 ""
Conversion between Python 2, 8, 10, and 16