On May 22, 12:07 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 21 May 2008 17:56:38 -0700, bukzor wrote: > > On May 21, 5:37 pm, Nikhil <[EMAIL PROTECTED]> wrote: > > >> if os.path.exists('file'): > >> open('file', 'w').close() > > >> Right? > > > You only want to blank it if it exists? If it doesn't exist you won't > > create it. > > The .close() is superlative: since you don't keep the value, it gets > > deallocated and closed by the destructor. > > The language neither guarantees *when* an object will be deallocated nor > that its destructor is called *at all*. It's cleaner to explicitly close > the file. > > Ciao, > Marc 'BlackJack' Rintsch
Good to know. -- http://mail.python.org/mailman/listinfo/python-list