[Tutor] Sys.argv read parameters

Danilo Chilene bicofino at gmail.com
Wed Apr 17 21:27:50 CEST 2013


Dear Python Tutor,

I have the code below(file.py):

import sys

a = 'This is A'
b = 'This is B'
c = 'This is C'

for i in sys.argv[1]:
    if sys.argv[1] == 'a':
        print a
    if sys.argv[1] == 'b':
        print b
    if sys.argv[1] == 'c':
        print c

I run python file.py a and returns the var a, so far so good.

The problem is that i have a bunch of vars(like a to z), how I can handle
this in a pythonic way?

Best Regards,

Danilo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130417/32e1b79f/attachment.html>


More information about the Tutor mailing list