name of this python program

Peter Abel PeterAbel at gmx.net
Wed Mar 10 16:16:33 EST 2004


leo <leo at bella.local> wrote in message news:<m2ptbl54u7.fsf at bella.local>...
> 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

try

print 'My modulname: %s' %  __file__

Will give you the filename of your modul.

Reagards
Peter



More information about the Python-list mailing list