A simple method for converting binary numbers to decimal, and a wise method for converting decimal numbers to binary (using hexadecimal in between.)
# Base 2 to Base 10
# This produces 6
int('0110', 2)
# Base 10 to Base 2
# This produces 0110
DecNum = 6
HexBin ={"0":"0000", "1":"0001", "2":"0010", "3":"0011", "4":"0100", "5":"0101", "6":"0110", "7":"0111", "8":"1000", "9":"1001", "A":"1010", "B":"1011", "C":"1100", "D":"1101", "E":"1110", "F":"1111"}
"".join([HexBin[i] for i in '%X'%DecNum]).lstrip('0')