Thanx, you are correct. And now I know that 'a' will create a file as well.
Magnus On Sun, Jan 17, 2010 at 10:34 AM, Steve Willoughby <st...@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. > >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor