check if dir exists

Abe Frohnman usenetNO at
Wed Jul 9 21:29:35 CEST 2003

Geiregat Jonas wrote:

> How can I check if a dir exists ?

The os.path library has just what you're looking for. Use 
os.path.exists, like so:


import os.path

pathToFind = "/usr/bin/local"

if os.path.exists(pathToFind):
         print "Path exists."
         print "Path does not exist."


More information about the Python-list mailing list