> f = file("foo", 'w')
Using 'w' will destroy the contents of the file,
I assume you are really using 'r'?
> fileContents = f.readlines()
Each line will be terminated by a newline, you
can use rstrip() to remove it:
> print fileContents[0].rstrip() + "Hi!"
HTH,
There is more on this topic in the file handling
topic of my tutorial.
Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor