How to delete a file using python

To delete a file using python you can use the following snippet.

Sample Python

import os  
try: os.unlink('filpath')  
except OSError: pass # failed...

Please Share us:
Please rate this snippet

One thought on “How to delete a file using python

Leave a Reply