On May 21, 5:10 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On 22 Mag, 01:15, Nikhil <[EMAIL PROTECTED]> wrote: > > > what are the simple ways? > > I could think of os.open(), os.exec(touch file) > > > are there any simpler methods? > > Just use os.path.exists to check for file existence and open() as > replacement for touch. > > >>> import os > >>> if not os.path.exists('file'): > > ... open('file', 'w').close() > ... > > > > --- Giampaolohttp://code.google.com/p/pyftpdlib/
As simple as it gets is a single builtin function call: open("somefile.txt", "a") Leave out the ,"a" if you don't mind blanking a pre-existing file. -- http://mail.python.org/mailman/listinfo/python-list