title: Extract a part of the filepath (a directory) in Python
body: <p>I need to extract the name of the parent directory of a certain path. This is what it looks like:</p>
  <pre><code>C:\stuff\directory_i_need\subdir\file.jpg
  </code></pre>
  <p>I would like to extract <code>directory_i_need</code>.</p>