Zygimantas Zygimantas - 1 month ago 4
Python Question

Delete a file or folder in Python

How do I delete a file or folder in Python?

Answer

os.remove() will remove a file.

os.rmdir() will remove an empty directory.

shutil.rmtree() will delete a directory and all its contents.