On 2007-06-08, jvdb <[EMAIL PROTECTED]> 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. http://docs.python.org/lib/module-mmap.html If you prefer it to appear as an array of bytes instead of a string, the various numeric/array packags can do that. Numarray: http://stsdas.stsci.edu/numarray/numarray-1.5.html/module-numarray.memmap.html Vmaps: http://snafu.freedom.org/Vmaps/Vmaps.html 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: http://groups.google.com/group/comp.lang.python/browse_frm/thread/c63c3e281df99897/2336baa98386d5e7 -- Grant Edwards grante Yow! I like your SNOOPY at POSTER!! visi.com -- http://mail.python.org/mailman/listinfo/python-list