shutil.rmtree()介绍

shutil.rmtree() 表示递归删除文件夹下的所有子文件夹和子文件。


因此如果想删除E盘下某个文件夹,可以用

shutil.rmtree('E:\\myPython\\image-filter\\test', ignore_errors=True)
这样 test 文件夹内的所有文件(包括 test 本身)都会被删除,并且忽略错误。

猜你喜欢

转载自blog.csdn.net/happyrocking/article/details/79806808