how can use mkdir to override the old one
Mark Nenadov
mnenadov at stclairc.on.ca
Wed Aug 1 08:54:28 EDT 2001
In article <mailman.996651362.9838.python-list at python.org>, "sdf"
<wqh-2 at 263.net> wrote:
> I use mkdir('doc'),but this directory is exists,so it throw an err. how
> can force to do this
I am not sure if there is a way you can force the mkdir. You could always
remove it first, then make it. But you could also do:
import os
try:
os.mkdir('doc')
except OSError:
pass
That would basicaly make the directory, unless it can't (because it
exists), in which case it would just do nothing because it is already
there. Hopefully that helps.
--
"The use of COBOL cripples the mind; its teaching should, therefore be
regarding as a criminal offense" - E. W. Dijkstra
~Mark Nenadov (author/editor for http://www.coffeecode.com)
More information about the Python-list
mailing list