def intcaststr(bitlist):
    return int(''.join(str(i) for i in bitlist), 2)

def intcastlookup(bitlist):
    return int(''.join('01'[i] for i in bitlist), 2)

def shifting(bitlist):
    out = 0
Bits list to integer in Python