免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5973 | 回复: 3
打印 上一主题 下一主题

rmdir 与removedirs 有什么区别? [复制链接]

论坛徽章:
4
天蝎座
日期:2013-11-06 11:39:34巳蛇
日期:2014-01-16 16:53:14午马
日期:2014-08-25 21:42:302015年迎新春徽章
日期:2015-03-03 17:21:44
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-01-18 12:02 |只看该作者 |倒序浏览
请问rmdir 与removedirs 有什么区别?谢谢

论坛徽章:
0
2 [报告]
发表于 2007-01-18 12:48 |只看该作者
建议去看文档。

论坛徽章:
0
3 [报告]
发表于 2007-01-22 17:54 |只看该作者
是不是很无语?
我跟踪学习.

removedirs( path)

Removes directories recursively. Works like rmdir() except that, if the leaf directory is successfully removed, removedirs() tries to successively remove every parent directory mentioned in path until an error is raised (which is ignored, because it generally means that a parent directory is not empty). For example, "os.removedirs('foo/bar/baz')" will first remove the directory "'foo/bar/baz'", and then remove "'foo/bar'"and "'foo'" if they are empty. Raises OSError if the leaf directory could not be successfully removed. New in version 1.5.2.

论坛徽章:
0
4 [报告]
发表于 2016-02-01 11:42 |只看该作者
os.removedirs() 方法用于递归删除目录。像rmdir(), 如果子文件夹成功删除, removedirs()才尝试它们的父文件夹,直到抛出一个error(它基本上被忽略,因为它一般意味着你文件夹不为空)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP