Feed on
Posts
Comments

when you execute a program in python, the program’s name can be found with the following command: 

import sys 

print sys.argv[0]

 to get the full path to the program, use the abspath command: 

import os 

os.path.abspath(sys.argv[0])

 

Stumble it!

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS

More blogs about http://desk.stinkpot.org:8080/tricks.