Nico Grubert <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> Hi there,
>
> I would like to open an existing file that contains some lines of
> text in order to append a new line at the end of the content.
>
> My first try was:
>
> >>> f = open('/tmp/myfile', 'w') #create new file for wr
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),
w
Use
file = open(open('/tmp/myfile', 'a')) the second time
when you want to append line
"Nico Grubert" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there,
>
> I would like to open an existing file that contains some lines of text in
> order to append a new line at the end of t
Hi there,
I would like to open an existing file that contains some lines of text
in order to append a new line at the end of the content.
My first try was:
>>> f = open('/tmp/myfile', 'w') #create new file for writing
>>> f.writelines('123') #write first line
>>> f.close()
>>> f