Zygimantas Zygimantas - 1 year ago 116
Python Question

Delete a file or folder in Python

How do I delete a file or folder in Python?

Answer Source

os.remove() will remove a file.

os.rmdir() will remove an empty directory.

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download