name of this python program

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed Mar 10 06:22:34 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]...

That'll be:

<code>
import sys
print sys.argv[0]
</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________




More information about the Python-list mailing list