append to a file

Thomas Wouters thomas at xs4all.net
Mon May 22 16:59:11 EDT 2000


On Mon, May 22, 2000 at 08:28:43PM +0000, Fredrik Lundh wrote:
> Scott Hathaway <slhath at flash.net> wrote:
> > How do I append to a file instead of overwriting it?  I searched on the
> > python website and got a hit, but the link was bad.
> 
> use the "a+" flag when opening the file (or "w+" and seek to the
> end of the file). 

Eep, no, do not use 'w+'. It'll truncate the file!

Hostile-F-bot-takeover?-ly y'rs,

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list