in reply to Bytes to bits

I'm surprised no one has suggested the pack() and unpack() functions - unpack() can extract bits, and assign them to separate variables, which you can re-assemble with pack.