+ 2
Writing Files
Is there any way to save the file's existing content, when the file is opened in write mode?
4 odpowiedzi
+ 6
Later on, open it in the 'append' mode.
open(file_name, 'a')
+ 5
You just close() it. Then it's saved.
+ 2
If you don't want to overwrite the file, do NOT open it in write mode. You can use the "r+" mode or the "a" (append) mode instead.
+ 1
when the file is opened in write mode again, file contents are removed. How to avoid this?