file_util.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:glazier 作者: google 项目源码 文件源码
def CreateDirectories(path):
  """Create directory if the path to a file doesn't exist.

  Args:
    path: The full file path to where a file will be placed.

  Raises:
    Error: Failure creating the requested directory.
  """
  dirname = os.path.dirname(path)
  if not os.path.isdir(dirname):
    logging.debug('Creating directory %s ', dirname)
    try:
      os.makedirs(dirname)
    except (shutil.Error, OSError):
      raise Error('Unable to make directory: %s' % dirname)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号