Here's a question for any python gurus out there. I'm trying to use python in an application where I have to do things like read 5 bits at a time from a file. I know, python is probably not the best tool for the job, but there are reasons for doing this with python. Anyway, does anyone know of a python library that will allow me to do this in a nice way?
Right now I'm reading a byte at a time, and applying a mask and shifting the remaining bits to get these results, but I have to go through a ridiculous song and dance to automatically calculate the appropriate mask. I was hoping that someone had come up with some sort of subroutine, ie "readBits( fileHandle, 3 )"