python 生成、删除、拷贝目录

时间:2015-05-14 16:08:46   收藏:0   阅读:133

1. 生成目录

函数原型:distutils.dir_util.mkpath(name[, mode=0777verbose=0dry_run=0])

from distutils import dir_util
dir_util.mkpath("new_dir")

2. 删除目录

函数原型:distutils.dir_util.remove_tree(directory[, verbose=0, dry_run=0])

from distutils import dir_util
dir_util.remove_tree(del_dir)

3. 拷贝目录

函数原型:distutils.dir_util.copy_tree(src, dst[, preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0])

from distutils import dir_util
dir_util.copy_tree("del", "del_copy")

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!