title: Convert UNC path to local path (and general path handling in Python)
body: <p>System: Python 2.6 on Windows 7 64 bit</p>
  
  <p>Recently I did a lot of path formatting in Python. Since the string modifications are always dangerous I started to do it the proper way by using the 'os.path' module.</p>
  
  <p>The first question is if this is the right way to to handle incoming paths? Or can I somehow optimize this?</p>
  
  <pre><code>sCleanPath = sRawPath.replace('\n', '')
  sCleanPath = sCleanPath.replace('\\', '/')
  sCleanPythonPath = os.path.normpath(sCleanPath)
  </code></pre>
  
  <p>For formatting the 'sCleanPythonPath' now I use only functions from the 'os.path' module. This works very nice and I didn't had any problems so far.</p>
  
  <p>There is only one exception. I have to change paths so they point not longer on a network storage but on a local drive. Is started to use 'os.path.splitunc()' in conjunction with 'os.path.join()'.</p>
  
  <pre><code>aUncSplit = os.path.splitunc(sCleanPythonUncPath)
  sLocalDrive = os.path.normpath('X:/mount')
  sCleanPythonLocalPath = (os.path.join(sLocalDrive, aUncSplit[1]))
  </code></pre>
  
  <p>Unfortunately this doesn't work due to the nature of how absolute paths are handled using 'os.path.join()'. All the solutions I found in the web are using string replacements again which I want to avoid by using the 'os.path' module. Have I overseen anything? Is there another, maybe a better way to do this?</p>
  
  <p>All comments on this are very welcome!</p>