why o/p is different ???

asit lipun4u at gmail.com
Thu Jan 15 05:28:29 EST 2009


On Jan 15, 11:47 am, "James Mills" <prolo... at shortcircuit.net.au>
wrote:
> On Thu, Jan 15, 2009 at 4:34 PM, asit <lipu... at 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

Thank you everyone



More information about the Python-list mailing list