title: Workflow to create a folder if it doesn't exist already
body: <p>In <a href="https://stackoverflow.com/questions/273192/in-python-check-if-a-directory-exists-and-create-it-if-necessary">this interesting thread</a>, the users give some options to create a directory if it doesn't exist.</p>
  <p>The answer with most votes it's obviously the most popular, I guess because its the shortest way:</p>
  <pre><code>if not os.path.exists(directory):
      os.makedirs(directory)
  </code></pre>
  <p>The function included in the 2nd answer seems more robust, and in my opinion the best way to do it.</p>
  <pre><code>import os
  import errno
  
  def make_sure_path_exists(path):
      try:
          os.makedirs(path)
      except OSError as exception:
          if exception.errno != errno.EEXIST:
              raise
  </code></pre>
  <p>So I was wondering, what does people do in their scripts? Type 2 lines just to create a folder? Or even worst, copy, and paste the function <code>make_sure_path_exists</code> in every script that needs to create a folder?</p>
  <p>I'd expect that such a wide spread programming language as Python would already have a library with includes a similar function.</p>
  <p>The other 2 programming languages that I know, which are more like scripting languages, can do this with ease.</p>
  <p>Bash: <code>mkdir -p path</code></p>
  <p>Powershell: <code>New-Item -Force path</code></p>
  <p>Please don't take this question as a rant against Python, because it's not intended to be like that.</p>
  <p>I'm planing to learn Python to write scripts where 90% of the time I'll have to create folders, and I'd like to know what is the most productive way to do so.</p>
  <p>I really think I'm missing something about Python.</p>