How to check if a directory is exist in python?

V

Vincent Wehren

|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.
|
 
V

Vincent Wehren

| ||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

Ofcourse I mean "exists"...

| (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.
||
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top