why o/p is different ???
alex23
wuwei23 at gmail.com
Thu Jan 15 01:42:14 EST 2009
On Jan 15, 4:34 pm, asit <lipu... at gmail.com> wrote:
> apppath = sys.argv[0].split("/")
> appname = apppath[len(apppath)-1]
I'd replace these two lines with the following:
import os.path # at the top of the file, of course
appname = os.path.basename(sys.argv[0])
Also note that you can use negative indices in lists, with -1 being
the last element, -2 the last but one etc.
More information about the Python-list
mailing list