title: How to get the name of parent directory in Python?
body: <p>I have a program in python that prints out information about the file system... I need to know to save the name of the parent directory to a variable...</p>
  
  <p>For example, if a tiny bit of the file system looked like this: <br />
  <strong>ParentDirectory</strong><br />
  <strong>ChildDirectory</strong><br />
  <strong>SubDirectory</strong><br />
  If I was inside of <em>ChildDirectory</em>, I would need to save the name <em>ParentDirectory</em> to a certain string... here is some <strong><em>pseudo code</em></strong>:
  <br />
  <code>import os</code><br />
  <code>var = os.path.parent()</code>
  <br />
  <code>print var</code><br />
  On a side note, I am using Python 2.7.6, so I need to be compatible with 2.7.6...</p>