[Tutor] adding more text to a file

Magnus Kriel magnus.kriel at gmail.com
Sun Jan 17 19:52:13 CET 2010

Thanx, you are correct. And now I know that 'a' will create a file as well.


On Sun, Jan 17, 2010 at 10:34 AM, Steve Willoughby <steve at alchemy.com>wrote:

> Magnus Kriel wrote:
> > It might be that when you create a file for the first time with 'a',
> > that it will through an exception. So you will have to try with 'w', and
> > if there is an exception, you know the file does not exist and you will
> > have to create the file for the first time with 'w'.
> That's a little confusing, I think.  I think you meant "try with 'a' and
> if there is an exception  ... create ... with 'w'" but that shouldn't be
> necessary anyway.  Opening a file with 'a' will append to an existing
> file, or create a new file if one doesn't exist already.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100117/11ffa4e2/attachment.htm>

More information about the Tutor mailing list