Scanning a file

pinkfloydhomer at gmail.com pinkfloydhomer at gmail.com
Fri Oct 28 07:25:22 EDT 2005


Okay, how do I do this?

Also, if you look at the code, I build a 32-bit unsigned integer from
the bytes I read. And the 32-bit pattern I am looking for can start on
_any_ byte boundary in the file. It would be nice if I could somehow
just scan for that pattern explicitly, without having to build a 32-bit
integer first. If I could tell python "scan this file for the bytes 0,
0, 1, 0 in succession. How many 0, 0, 1, 0 did you find?"

/David




More information about the Python-list mailing list