Reading a Bitstream
Dietrich Epp
dietrich at zdome.net
Tue Nov 18 17:26:30 EST 2003
On Nov 18, 2003, at 7:28 AM, Miki Tebeka wrote:
> Hello Dietrich,
>
>> Are there any good modules for reading a bitstream? Specifically, I
>> have a string and I want to be able to get the next N bits as an
>> integer. Right now I'm using struct.unpack and bit operations, it's a
>> bit kludgy but it gets the right results.
> Have you looked at 'array' and 'xdrlib.Upnacker'?
Both of those look like they're aligned to byte boundaries. Am I
mistaken?
The file I'm reading has fields ranging from 1 to 32 bits wide, and
they are packed bit-to-bit.
I guess I'll write my own module.
More information about the Python-list
mailing list