change a string in text file then write it

Jose spamzostar at
Mon Nov 6 08:42:28 CET 2000

Hey all,
I am reading in a simple text file with readlines(foo)
I go into a loop to simple search a regexp, I can find
this regexp ok.  I change a part of the string using
string.replace(...) and it actually does change it ok,
BUT when I now want to write this change to a file
using simple output.writelines(lines) It does not know
that I have changed a piece of a string on a line.
There obviously is a way to change a small piece of
a string on a line and then write it back out to a
file but I am having difficulty, new to python.
The book I have doesn't have an example of this.
do remv "spam" on my email address
visit EFF the future of the Internet depends on it!

More information about the Python-list mailing list