title: Check for invalid path in Python
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="https://stackoverflow.com/questions/82831/how-do-i-check-if-a-file-exists-using-python">How do I check if a file exists using Python?</a></p>
  </blockquote>
  
  <p>I am a beginner at Python. I have a bit of code that I want to handle in a way if that someone was to enter an invalid path that does not exist like <code>Z:\</code> instead of <code>C:\</code> I want it to raise some sort of error. I know how to go about doing it, I just don't know how to check if it will be invalid. How can I make my code check if that drive or path exists on this PC before it creates the path, is there a way to do that in python?</p>
  <pre><code>file_path = input(&quot;\nEnter the absolute path for your file: &quot;)
  </code></pre>