os.makedirs(name, mode=0o777, exist_ok=False)
作用
用来创建多层目录(单层请用os.mkdir)
参数说明
name:你想创建的目录名
mode:要为目录设置的权限数字模式,默认的模式为 0o777 (八进制)。
exist_ok:是否在目录存在时触发异常。如果exist_ok为False(默认值),则在目标目录已存在的情况下触发FileExistsError异常;如果exist_ok为True,则在目标目录已存在的情况下不会触发FileExistsError异常。
os def makedirs(name: Union[str, bytes, PathLike[str], PathLike[bytes]],
mode: int = …,
exist_ok: bool = …) -> None
makedirs(name [, mode=0o777][, exist_ok=False]) Super-mkdir; create a leaf directory(叶目录) and all intermediate(中间) ones. Works like mkdir, except that any intermediate path segment (not just the rightmost(最右边的)) will be created if it does not exist. If the target directory already exists, raise an OSError if exist_ok is False. Otherwise no exception is raised. This is recursive.(递归)
来自https://blog.csdn.net/viven_hui/article/details/101274815