An expression like map(int, list(bin((1<<8)+x))[-4:]) will give you the low 4 bits of a number, as a list. (Edit: A cleaner form is map(int,bin(x)[2:].zfill(4)) ; see below.) If you know how many bits you wish to show, replace the 4 (in [-4:]) with that number; and make the 8 (in (1<<8)) a larger number if necessary. For example:
>>> x=0b0111
>>> map(int,list(bin((1<<8)+x))[-4:])
[0, 1, 1, 1]
>>> x=37; map(int,list(bin((1<<8)+x))[-7:])
[0, 1, 0, 0, 1, 0, 1]
>>> [int(d) for d in bin((1<<8)+x)[-7:]]
[0, 1, 0, 0, 1, 0, 1]
The last example above shows an alternative to using map and list. The following examples show a slightly cleaner form for obtaining leading zeroes. In these forms, substitute the desired minimum number of bits in place of 8.
>>> x=37; [int(d) for d in bin(x)[2:].zfill(8)]
[0, 0, 1, 0, 0, 1, 0, 1]
>>> x=37; map(int,bin(x)[2:].zfill(8))
[0, 0, 1, 0, 0, 1, 0, 1]
>>> x=37; map(int,bin(x)[2:].zfill(5))
[1, 0, 0, 1, 0, 1]
>>> x=37; map(lambda k:(x>>-k)&1, range(-7,1))
[0, 0, 1, 0, 0, 1, 0, 1]
0b0111 == 0b111so what's the problem? If you need the lists to be fixed length, then just tack on the appropriate amount of 0's to the beginning.