How to check if a directory is exist in python?

Vincent Wehren vincent at visualtrans.de
Sun Mar 19 22:39:53 CET 2006


<yinglcs at gmail.com> wrote in message 
news:1142803465.164833.38160 at j33g2000cwa.googlegroups.com...
|I check the documentation here, but it does not say how to check if a
| directory is exist in python?
| http://docs.python.org/lib/os-file-dir.html

Look at the exist or isdir  methods of the os.path module 
(http://docs.python.org/lib/module-os.path.html}

|
| And why mkdir fails if the directory already exists?

If you prefer a "more friendly" approach you may wanna take a look at Trent 
Mick's _mkdir which is located at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82465
|

Regards,
Vincent Wehren

| Thank you.
| 





More information about the Python-list mailing list