Hi Kent:
Thanks for your response. The Grep function does a really good job of searching
across .py files in a directory or subdirectories for the specific
keyword/string.
In the PythonWin interpreter 2.1, Go to File -> New -> Grep and the search
string can be entered. It is useful in searching strings across multiple files,
especially in large projects.
~Janesh
Message: 1
Date: Thu, 30 Mar 2006 21:22:39 -0500
From: Kent Johnson <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Searching across .Py files for a particular
string/ character
Cc: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
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