title: How to overwrite a folder if it already exists when creating it with makedirs?
body: <p>The following code allows me to create a directory if it does not already exist.</p>
  
  <pre><code>dir = 'path_to_my_folder'
  if not os.path.exists(dir):
      os.makedirs(dir)
  </code></pre>
  
  <p>The folder will be used by a program to write text files into that folder. But I want to start with a brand new, empty folder next time my program opens up. </p>
  
  <p>Is there a way to overwrite the folder (and create a new one, with the same name) if it already exists?</p>