python 生成、删除、拷贝目录

时间:2015-05-14 16:05:35   收藏:0   阅读:244

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")

 

原文:http://www.cnblogs.com/kaituorensheng/p/4498788.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!