📜  python 删除空文件夹 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:55.573000             🧑  作者: Mango

代码示例1
import os
def drop_empty_folders(directory):
    """Verify that every empty folder removed in local storage."""

    for dirpath, dirnames, filenames in os.walk(directory, topdown=False):
        if not dirnames and not filenames:
            os.rmdir(dirpath)