import os
def delete_contents(folder_paths):
for folder_path in folder_paths:
for filename in os.listdir(folder_path):
file_path = os.path.join(folder_path, filename)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
delete_contents([file_path])
os.rmdir(file_path)
except Exception as e:
print(f"Failed to delete {file_path}. Reason: {e}")
# Укажите пути к папкам, содержимое которых нужно удалить
folder_paths = ["путь_к_папке_1", "путь_к_папке_2", "путь_к_папке_3"]
delete_contents(folder_paths)