title: Python - Reverse os.path.basename
body: <p>Is there any way to reverse os.path.basename?</p>
  
  <p>I have an attribute for my tree class like this:</p>
  
  <pre><code>self.root_ = os.path.basename(path)
  </code></pre>
  
  <p>and in a public method for the same tree class I would like to the find the whole path off of that one basename.</p>
  
  <p>So for example:</p>
  
  <pre><code>my_path = F:\User\Word\TESTING\B
  self.root_ = os.path.basename(my_path)
  &gt;&gt;&gt; B
  "code to reverse this"
  &gt;&gt;&gt; F:\User\Word\TESTING\B
  </code></pre>