Writing multiple lines to a file

Martin Skøtt mskott at image.dk
Sat Jan 29 15:34:15 EST 2000


Hi
I am trying to create a program that writes several lines to a file
but I have encountered some minor problems.
I write to the file using the following code:
f.write(S)  # S contains a string I wish to write to the file
f.close()

The line gets written to the file but if I run the program again the
line generated in the previous run gets overwritten? I dont want that,
I want the program to append my string to the file without touching
other lines. Can you help me.
I am sorry if this is a FAQ but i'm all new to Python.

-- 
Martin Skøtt
mskott at image.dk

"Every time I learn something new it pushes some old suff out of my brain"
Homer Simpson



More information about the Python-list mailing list