Changing a line in a text file

kah kahsiang.wong at gmail.com
Mon Apr 25 05:39:11 EDT 2005


How do I change a line in a file??

For example I have the follwing text in my file:

line1
line2
line3
line4

How do I replace 'line2' with 'newline'. Since the write operation in
python will  overwrite everything.

Regards,
Kah




More information about the Python-list mailing list