[Python-Dev] mkdir -p in python
Ray Allen
ysj.ray at gmail.com
Mon Jul 19 10:49:26 CEST 2010
See http://bugs.python.org/issue9299
On Mon, Jul 19, 2010 at 1:16 PM, Ray Allen <ysj.ray at gmail.com> wrote:
>
> Agree. Through searching for existing issues, I found there isn't any such
> request. And I will submit one.
>
> The '-p' option of shell's mkdir has tow functions:
> 1, create parents directories if not exists,
> 2, suppress "File exists" error if the target has already exists.
> What we need is the second function. So I think both os.mkdir() and
> os.makedirs() should add a keyword argument to suppress the "OSError: [Errno
> 17] File exists". So we can remove many "try...except..." codes surround
> os.mkdir() and os.makedirs() as Greg said, "The operation of 'make sure
> this directory and all its parents exist' is very commonly required"
>
> --
> Ray Allen
> Best wishes!
>
--
Ray Allen
Best wishes!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100719/d5bb8650/attachment.html>
More information about the Python-Dev
mailing list