Re: [Tutor] Searching across .Py files for a particular string/ character

2006-03-30 Thread Kent Johnson
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 spe

Re: [Tutor] Searching across .Py files for a particular string/character

2006-03-30 Thread David Heiser
Here's a simple Python script that will do it. It's not very sophisticated, but it's easy to modify for special cases. import os, string def Find(TargetString, DIR, Names): for Name in Names: if Name != "Search.py": try: TargetFile = DIR + "/" + Name