title: Check whether a path is valid in Python
body: <p>Is there any easy way to check whether a path is valid? The file doesn't have to exist now, I'm wondering if it could exist.</p>
  
  <p>my current version is this:</p>
  
  <pre><code>try:
    f = open(path)
  except:
    &lt;path invalid&gt;
  </code></pre>
  
  <p>I'm considering simply checking whether the path contains any of <a href="http://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words" rel="noreferrer">these</a> characters.</p>