[Tutor] Files, directories and syntax
Karen Windus
kwindus@hotmail.com
Thu, 01 Mar 2001 20:40:58
I've been asked to resend this as an attachment. Actually, I'll just repaste
into this document and hope that works. I was sending the last message from
my shell account so I guess pine didn't like my attempts to indent (the
script is indented, although I don't know if it is correctly).
#! /usr/bin/env python
def change_lines(directory = None):
import glob, re
result = []
filepattern = '*.{html}'
filelist = glob.glob1(directory, filepattern)
regexp = re.compile(r"Your Turn")
for i in filelist:
file = open(i,"rw")
print "We opened a file"
for file in filelist:
lines = filenames.readlines()
for line in lines:
result = regexp.search(line)
if result == None:
print "Result was equal to None"
elif 'Your' in line or 'Turn' in line:
print "we had a match"
print result
else:
print "Nothing happened"
return result
file.close()
change_lines()
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com