files: direct access - NOT sequential

Alex Martelli aleax at aleax.it
Tue Apr 15 11:15:57 EDT 2003


<posted & mailed>

Patrick Carabin wrote:
   ...
> how do i have to manage it to keep the contents that are already in
> the file ? Do You have some example?

As I already posted, mode 'r+' is what you need if the file already
exists, in order to keep its previous contents except when you
specifically overwrite them ('r+b' if it's a binary-file).


Alex
 




More information about the Python-list mailing list