Larry Bates wrote:
> Jason Jiang wrote:
> > Hi,
> >
> > How to get the name of the running .py file like the macro _FILE_ in C?
> >
> > Thanks.
> > Jason
> >
> >
> >
> import os
> import sys
> print sys.argv[0]
>
> or if you just want the script and not the full path
>
> print os.path.basename(sys.argv[0])
>
> -Larry Bates

Also, check out:
http://groups.google.ca/group/comp.lang.python/browse_frm/thread/712572b3c2f2cb13

Peace,
~Simon

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to