python删除空目录 import os for root, dirs, files in os.walk(dir_path): if not os.listdir(root): os.rmdir(root)