[Tutor] Pass variable on command line

jason swimlappy at gmail.com
Thu Jul 26 21:02:36 CEST 2007


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 inside my program?

If I do a VALUES = sys.argv[1], then I get List1 as the values.  I want the
actual list elements.

Is this possible?

Thank you

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070726/73f5aa3b/attachment.html 


More information about the Tutor mailing list