how can use mkdir to override the old one

Alex Martelli aleaxit at yahoo.com
Wed Aug 1 07:15:17 EDT 2001


"sdf" <wqh-2 at 263.net> wrote in message
news:mailman.996651362.9838.python-list at python.org...
> I use mkdir('doc'),but this directory is exists,so it throw an err.
> how can force to do this

No operating system that I know has the concept of "overriding"
an existing directory.  If the directory that already exists is
good, just catch the OSError that mkdir raises with a try/except.
If you want to rename the existing directory then create a new
one of the same name, do so.  And so on, and so forth; your
description and implication of your desires and problems is
far too short and unclear for me to be of any more help.


Alex






More information about the Python-list mailing list