Skip to content
Advertisement

Tag: bit

Using Python How can I read the bits in a byte?

I have a file where the first byte contains encoded information. In Matlab I can read the byte bit by bit with var = fread(file, 8, ‘ubit1’), and then retrieve each bit by var(1), var(2), etc. Is there any equivalent bit reader in python? Answer Read the bits from a file, low bits first.

Advertisement