Janesh Ramakrishnan wrote:
> Hi Folks,
> 
> I was wondering what would be the best way to look up a string across
> 
different files in the Python interpreter (PythonWin 2.4). The find
function only finds files within currently open files. If I have a
folder of .py scripts and need to look up a specific keyword or string
among all these files within the project folder, is there any method
that you'd recommend?

I would do that in my editor, probably. But Python can get a list of 
files in a directory with os.listdir(). Loop over the files, use 
os.path.join() to make a full path, open the file, read the data, look 
for the string in the data.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to