"Kent Johnson" <ken...@tds.net> wrote
for filename in os.listdir(directory):
result = re.match(s, filename)
print result
You never open and read the files. You are searching for the pattern
in the filename, not in the contents of the file.
Also note that match() only searches starting at the start of the
string.
Thus match will find foo at
foobar
but not in
sofoo
You usually need to use search() to find the pattern anywhere
within the string.
Also look at the thread earlier this week on using listdir() and
the fileinput module.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor