Re: [Tutor] Pass variable on command line

2007-07-26 Thread Andreas Kostyrka
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Alternatively, I prefer something nicer: import optparse p = optparse.OptionParser(usage="%prog [options]") p.add_option("--list1", action="store_const", const=["blue", "red", "green"], dest="worklist", help="use the first setting") p.add_option("--li

Re: [Tutor] Pass variable on command line

2007-07-26 Thread jason
Ok, I see now. A dictionary using the list elements as values. This will work for me. Thanks! jason On 7/26/07, Eric Brunson <[EMAIL PROTECTED]> wrote: jason wrote: > Hello, > > I have a situation where I have 2 lists > > List1 = ['blue', 'red', green'] > List2 = ['red', 'yellow', 'orange'

Re: [Tutor] Pass variable on command line

2007-07-26 Thread Terry Carroll
On Thu, 26 Jul 2007, jason wrote: > Hello, > > I have a situation where I have 2 lists > > List1 = ['blue', 'red', green'] > List2 = ['red', 'yellow', 'orange'] > > And I would like to pass the list name on the command line like so > > ./test.py List1 > > I know I can get the argument using s

Re: [Tutor] Pass variable on command line

2007-07-26 Thread Eric Brunson
jason wrote: > Hello, > > I have a situation where I have 2 lists > > List1 = ['blue', 'red', green'] > List2 = ['red', 'yellow', 'orange'] > > And I would like to pass the list name on the command line like so > > ./test.py List1 > > I know I can get the argument using sys.argv[1] > >

[Tutor] Pass variable on command line

2007-07-26 Thread jason
Hello, I have a situation where I have 2 lists List1 = ['blue', 'red', green'] List2 = ['red', 'yellow', 'orange'] And I would like to pass the list name on the command line like so ./test.py List1 I know I can get the argument using sys.argv[1] But how can I then use the values in that list