How to delete a file or folder?

Zygimantas picture Zygimantas · Aug 9, 2011 · Viewed 2.2M times · Source

How do I delete a file or folder in Python?

Answer

RichieHindle picture RichieHindle · Aug 9, 2011

Path objects from the Python 3.4+ pathlib module also expose these instance methods: