how to search multiple textfiles ? (Python is slow ?)

Méta-MCI (MVP) enleverlesX.XmcX at
Sat Sep 27 08:59:20 CEST 2008

Hi !

Thanks for return.

Some infos: from a long time, I found that it's often more fast to use 
windows's command, instead of develop in high level language (and also, 
low level...)

FINDSTR is fast. OK. But internal commands are more fast. Example : DIR 
(with all his options)
And it's faster to read the result via a Pipe.
Thus, I use frequently this sort of function:

import os

def cmdone(repstart, commande, moderetour="LIST"):
    if moderetour.upper() == "STR":
        return sret
        return sret.split('\n')

print cmdone('D:\\dev\\python','findstr /N /I ponx *.py','STR')
print cmdone('D:\\dev\\python','dir *.jpg /B')

Sorry for my bad english, and have a good day...
Michel Claveau

More information about the Python-list mailing list