How to make scripts auto-delete at the end of execution?

This way makes your program non OS dependant.

from os import remove
from sys import argv

remove(argv[0])

Bonus points:
When parsing arguments the very first argument that you get in sys.argv is equals to “path-to-filename/filename.py

Leave a Comment