Q4
What is the difference between `os.remove()` and `os.rmdir()`?
💬Answer
os.remove(path): Deletes a file. Raises an error if the path points to a directory.os.rmdir(path): Deletes an empty directory. Raises an error if the directory contains files or subdirectories.
Related Python Questions
View All PythonQuestions →
Created by
Apurv Gujjar
DevOps & Cloud Engineer
Specialized in:DevOpsAWSGCPKubernetesTerraformDocker
View Portfolio