我是靠谱客的博主 纯情万宝路,这篇文章主要介绍os.removedirs Directory not empty python,现在分享给大家,希望可以做个参考。

os.removedirs(self.outputdir)

时出现Error:Directory not empty

import shutil
shutil.rmtree(self.outputdir, ignore_errors=True)

问题解决。
python判断文件是否存在:

import os
os.path.isfile(file_path)
或者
os.path.exists(file_path)

判断文件夹是否存在:

os.path.exists(file_dir)

创建文件夹:

os.makedirs(file_dir)

创建文件:

os.mknod(file)

最后

以上就是纯情万宝路最近收集整理的关于os.removedirs Directory not empty python的全部内容,更多相关os.removedirs内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部