[Tutor] Does directory exist?

Jay Dorsey python@jaydorsey.com
Thu Apr 3 15:30:04 2003


Michael Montagne wrote:
> What is the best way to check for the existence of a directory?
> I used os.stat() in a try:except: statement.  It seems the os.access()
> function is intended for this but I can't get it to accept F_OK as the
> mode argument.  

How about:

 >>> import os
 >>> os.path.isdir("/home/me")


-- 
Jay Dorsey
python at jay dorsey dot com