title: How to save the file with different name and not overwriting existing one
body: <p>I need to run a python script repeatedly over different data set. This python script test.py processes the data set, plot and save the result using the command.</p>
  
  <pre><code>plt.savefig('result.png')
  </code></pre>
  
  <p>How can I ensure that when the same <code>test.py</code> scripts runs on another data set.. the new <code>result.png</code> doesn't overwrite my previous result? Basically before executing <code>plt.savefig('result.png')</code>, I need to check if result.png already exist and if does then rename the result to any other name like </p>
  
  <pre><code>result1.png
  result2.png
  </code></pre>
  
  <p>Otherwise, in the next post processing the file is overwritten.</p>