A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/318223.html below:

How to use writelines to append new lines to an existing file

How to use writelines to append new lines to an existing file How to use writelines to append new lines to an existing fileTom Brown tom at thebrownboys.net
Thu Sep 22 09:25:32 EDT 2005
On Thursday 22 September 2005 05:52, Nico Grubert wrote:
> Does  f = open('/tmp/myfile', 'w')  overwrite the existing file or
> does f.writelines('456') replace the first line in the existing file?

Here's an excerpt from open.__doc__

   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.


Tom

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4