Entry
How do I append to a file instead of overwriting it?
May 24th, 2000 07:04
unknown unknown, Emile van Sebille, Thomas Wouters
Opening in 'append' mode, by passing 'a' as the 'how' flag to open:
file = open("my_file", "a")
Here's how you can find out:
>>> print open.__doc__
open(filename[, mode[, buffering]]) -> file object
Open a file. The mode can be 'r', 'w' or 'a' for reading (default),
writing or appending. The file will be created if it doesn't exist
when opened for writing or appending; it will be truncated when
opened for writing. Add a 'b' to the mode for binary files.
Add a '+' to the mode to allow simultaneous reading and writing.
If the buffering argument is given, 0 means unbuffered, 1 means line
buffered, and larger numbers specify the buffer size.
Or you can use the Library reference for open(), at
http://www.python.org/doc/lib/