vanam, 22.01.2010 07:44:
> [Query]: How to write Python string to PYTHON to that file without
> intact of the full contents

What one would normally do is: read the file (line by line if that's ok in
your case), replace the word by the new one, write the new line to a new
temporary file. When done, move the new file over the old one. That also
makes sure that your changes are 'atomic' (as good as it gets), i.e. your
original file is still there when you encounter an error during the
replacement run.

Stefan

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to