basename

Get name of current script in Python

Get name of current script in Python Question: I’m trying to get the name of the Python script that is currently running. I have a script called foo.py and I’d like to do something like this in order to get the script name: print(Scriptname) Asked By: SubniC || Source Answers: You can use __file__ to …

Total answers: 14