Is there a way to overwrite log files in python 2.x : <p>I'm using python2.x logging module, like,</p>

<pre><code>logging.basicConfig(format='%(asctime)s %(message)s',
                datefmt='%m/%d/%Y %I:%M:%S %p',
                filename='logs.log',
                level=logging.INFO)
</code></pre>

<p>I want my program to overwrite logs.log file for each execution of the script, currently it just appends to old logs. 
I know the below code will overwrite, but if there is a way to do it via logging config, it'll look better.</p>

<pre><code>with open("logs.log", 'w') as file:
  pass
</code></pre>
