Python3 os.makedirs() 方法
Python 3 教程
· 2019-02-07 15:13:15
概述
os.makedirs() 方法用于递归创建目录。像 mkdir(), 但创建的所有intermediate-level文件夹需要包含子目录。
语法
makedirs()方法语法格式如下:
os.makedirs(path, mode=0o777)
参数
path -- 需要递归创建的目录。
mode -- 权限模式。
返回值
该方法没有返回值。
实例
以下实例演示了 makedirs() 方法的使用:
#!/usr/bin/python3
import os, sys
# 创建的目录
path = "/tmp/home/monthly/daily"
os.makedirs( path, 0o777 );
print ("路径被创建")
执行以上程序输出结果为:
路径被创建
点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html
Letting Go of the Words
Janice (Ginny) Redish / Morgan Kaufmann / 2007-06-11 / USD 49.95
"Redish has done her homework and created a thorough overview of the issues in writing for the Web. Ironically, I must recommend that you read her every word so that you can find out why your customer......一起来看看 《Letting Go of the Words》 这本书的介绍吧!