On Thu, Jan 15, 2009 at 4:34 PM, asit <lipu...@gmail.com> wrote: > I recently faced a peculiar o/p. > > My objective is to remove the command name(my script name) from > sys.argv[0]. > I coded like this
If you _really_ want to remove your script_name from sys.argv, then do this: del sys.argv[0] If you're just after what the name of your script is that's being run (for human readability) try the following function (taken from pymills): def getProgName(): """getProgName() -> str Return the name of the current program being run by working it out from the script's basename. """ return os.path.basename(sys.argv[0]) -------------------------------------------------- cheers James -- http://mail.python.org/mailman/listinfo/python-list