On Fri, 05 Jun 2009 17:37:25 +0200, Hendrik van Rooyen wrote: > "kj" <no.em...@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". >> >> 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? -- Steven -- http://mail.python.org/mailman/listinfo/python-list