fastest way to test file for string?

Aaron Brady castironpi at gmail.com
Sat Jun 6 00:43:55 CEST 2009


On Jun 5, 5:50 am, kj <no.em... at please.post> wrote:
> Hi.  I need to implement, within a Python script, the same
> functionality as that of Unix's
>
>    grep -rl some_string some_directory
>
> I.e. find all the files under some_directory that contain the string
> "some_string".
snip

The 'mmap.mmap' class has a 'find' method.  Not what you asked for,
put possibly an alternative.  No regex 'search' method either.



More information about the Python-list mailing list