how to do reading of binary files?

Grant Edwards grante at
Fri Jun 8 16:32:55 CEST 2007

On 2007-06-08, jvdb <streamservenl at> wrote:

> I have a binary (pcl) file.
> In this file i want to search for specific codes (like <0C>). I have
> tried to solve it by reading the file character by character, but this
> is very slow. Especially when it comes to files which are large
> (>10MB) this is consuming quite some time.
> Does anyone has a hint/clue/solution on this?

I'd memmap the file.

If you prefer it to appear as an array of bytes instead of a
string, the various numeric/array packags can do that.

Numpy:     <documentation is not free>

Since I can't point you to Numpy docs, here's a link to a
newsgroup thread with an example for numpy:

Grant Edwards                   grante             Yow! I like your SNOOPY
                                  at               POSTER!!

More information about the Python-list mailing list