Deleting or Empty a File

Tim Golden mail at
Tue Apr 17 08:15:02 EDT 2007

Robert Rawlins - Think Blue wrote:
> I'm looking to clear those log files we were discussing earlier chaps,
> What the best method to do this? Delete the file completely? Or just empty
> its content?

Not sure there is a "best method". For simplicity I'd
just delete it and let the logger recreate, but
there's nothing to stop you from doing:

   open ("blah.log", "w").close ()

if you want.


More information about the Python-list mailing list