Parsing command line options

Dialtone dialtone#/N0SPAM/# at aruba.it
Thu May 23 17:49:36 EDT 2002


On Thu, 23 May 2002 14:12:37 -0700, Daniel Klein <danielk at aracnet.com> wrote:

>Am I on the right track or am I derailed? ;-)

You're on the right way

sys.argv[0] is the script name

sys.argv[1:] are all the options.

In this case:
c:\test\mytest.py option1 option2 option3

sys.argv[0] will be mytest.py

and sys.argv[1:]

['option1','option2','option3']

HTH

bye

-- 
try: troll = "Brain"
except TypeError, data: 
   troll.plonk()
Co-Responsabile Hardware Information & Technology http://hit.edengames.net



More information about the Python-list mailing list