fastest way to test file for string?
steve at REMOVE-THIS-cybersource.com.au
Fri Jun 5 22:19:45 EDT 2009
On Fri, 05 Jun 2009 17:37:25 +0200, Hendrik van Rooyen wrote:
> "kj" <no.email 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
>> I imagine that I can always resort to the shell for this, but is there
>> an efficient way of doing it within Python?
>> (BTW, portability is not high on my list here; this will run on a Unix
>> system, and non-portable Unix-specific solutions are fine with me.)
> Use grep. You will not beat it's performance.
What makes you think that performance of the find itself is the only, or
even the main, consideration?
More information about the Python-list