title: How can I get the proper capitalization for a path?
body: <p>Let's say I have a class which represents a directory (simplified example of course):</p>
  
  <pre><code>import os
  class Dir:
      def __init__(self, path):
          self.path = os.path.normcase(path)
  </code></pre>
  
  <p>To make things easier to implement internally, I am calling <a href="https://docs.python.org/3/library/os.path.html#os.path.normcase" rel="nofollow"><code>os.path.normcase</code></a> on the <code>path</code> argument before I save it into an attribute.  This works great, but it lowercases the path:</p>
  
  <pre><code>&gt;&gt;&gt; import os
  &gt;&gt;&gt; os.path.normcase(r'C:\Python34\Lib')
  'c:\\python34\\lib'
  &gt;&gt;&gt;
  </code></pre>
  
  <p>I would like a way to turn the path back into its properly capitalized form of <code>C:\Python34\Lib</code>.  I plan to do this inside the <code>__repr__</code> method so that I can get nice outputs such as:</p>
  
  <pre><code>&gt;&gt;&gt; my_dir
  Dir(r'C:\Python34\Lib')
  &gt;&gt;&gt;
  </code></pre>
  
  <p>when I am in the interactive interpreter. Is there anything like this in the standard library?</p>
  
  <hr>
  
  <p><strong>Note:</strong> I am not referring to the string that the user supplied as the <code>path</code> argument.  If a user does:</p>
  
  <pre><code>my_dir = Dir('c:\PYTHON34\lib')
  </code></pre>
  
  <p>I still want <code>Dir('C:\Python34\Lib')</code> to be printed in the interpreter because that is the proper capitalization.  Basically, I want the outputed paths to be the same as they are in the file explorer.</p>