A Simple question about a slice of a string.

Jay R. Wren jrwren at ice.acs.oakland.edu
Fri Jun 2 17:12:29 EDT 2000


I'm attempting to accomplish grabbing the last 6 characters of sys.argv[0]
so that I can compare it to another string.
If 'myprog' is called as /usr/local/bin/myprog.  It could be called from any
path, as long as the 'myprog' portion is there, certain things will
execute.(this is used as a symlink)

myprogname = sys.argv[0][ len(sys.argv[0])-10:len(sys.argv[0])

it works like this, but I think there is a better, more proper way of doing
it.  can someone let me know.  Thanks.

-Jay





More information about the Python-list mailing list