Efficient scanning of mbox files
Paul Moore
gustav at morpheus.demon.co.uk
Mon Nov 11 15:49:35 EST 2002
Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com> writes:
> Another thought.... if you have Python 2.2 (or greater) you can
> iterate through the file :-
>
> for line in fp:
> if line.startswith("From "):
> posns.append(oldpos)
>
>
> Again this should shave a second or two from the result...
Unfortunately, that one's no good. The file iterator gets its speed by
reading in blocks and buffering. That makes all of the offsets gained
from the calls to tell() useless :-(
Paul.
--
This signature intentionally left blank
More information about the Python-list
mailing list