赞
踩
via: http://bookshadow.com/weblog/2014/10/02/python-mkdir-p/
- import os, errno
-
- def mkdir_p(path):
- try:
- os.makedirs(path)
- except OSError as exc: # Python >2.5 (except OSError, exc: for Python <2.5)
- if exc.errno == errno.EEXIST and os.path.isdir(path):
- pass
- else: raise
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。