[Tutor] Fwd: Sys.argv read parameters
Dave Angel
davea at davea.name
Thu Apr 18 15:31:56 CEST 2013
On 04/18/2013 09:21 AM, Danilo Chilene wrote:
> On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel <davea at davea.name> wrote:
>
>>
>> ---------- Forwarded message ----------
>>> From: Danilo Chilene <bicofino at gmail.com>
>>> Date: Wed, Apr 17, 2013 at 2:17 PM
>>> Subject: Re: [Tutor] Sys.argv read parameters
>>> To: Danny Yoo <dyoo at hashcollision.org>
>>>
>>>
>>> Hello Danny,
>>>
>>> The part that is changing is just the sys.argv[1]
>>> The vars will have always the same content.
>>>
>>> What I don't want is to have like 255 'ifs' if I have 255 vars.
>>>
>>>
>> Please don't top post. Put your response AFTER the part you're quoting.
>>
>>
>>
>>> On Wed, Apr 17, 2013 at 5:03 PM, Danny Yoo <dyoo at hashcollision.org>
>>> wrote:
>>>
>>>>
>>>> What's the part that's "changing"? What's the part that stays the same?
>>>>
>>>>
>> Are all the strings going to be identical except for the one letter? If
>> so, then read the better responses here, like those from Danny Yoo
>>
>>
> The strings will always be the same except for the letter.
>
Then in that case, why do you use any if-test? Just substitute the
letter, as Danny pointed out.
You never said whether you accept more than one letter from the command
line. I've been assuming you do, since you used a loop.
for letter in sys.argv[1].upper():
print "This is uppercase of one of the input letters, %s" % letter
--
DaveA
More information about the Tutor
mailing list