Q4
How do you delete a directory recursively in Python?
💬Answer
Use shutil.rmtree(path). This deletes the directory and all of its contents (files, subdirectories, links) recursively. Use with caution!
import shutil
shutil.rmtree("/tmp/cache_folder")
Related Python Questions
View All PythonQuestions →
Created by
Apurv Gujjar
DevOps & Cloud Engineer
Specialized in:DevOpsAWSGCPKubernetesTerraformDocker
View Portfolio