name of this python program
Gandalf
gandalf at geochemsource.com
Wed Mar 10 07:00:19 EST 2004
>
>
>hi there
>
>when i start a python script with
> python myprog.py
>how can i find out the name of my script ("myprog.py") inside the script
>itself. looking for something like args[0]...
>
>cheers, leo
>
>
import sys
print sys.argv[0]
However, it can be wrong if you run it that way ('python myprog.py'). It
works when you run it this way: 'myprog.py'.
Best,
G
More information about the Python-list
mailing list