"Fredrik Lundh" <[EMAIL PROTECTED]> wrote::
def grep(pattern, *files):
search = re.compile(pattern).search
for file in files:
for index, line in enumerate(open(file)):
if search(line):
print ":".join((file, str(index+1), line[:-1]))
grep("grep", *glob.glob("*.py"))I was afraid the re module was the answer. ;-) Use of enumerate is a nice idea. Thanks. Alan -- http://mail.python.org/mailman/listinfo/python-list
