Flag control variable

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Feb 12 10:42:37 EST 2014


On 12/02/2014 15:32, luke.geelen at gmail.com wrote:
> Op woensdag 12 februari 2014 06:23:14 UTC+1 schreef Dave Angel:
>> luke.geelen at gmail.com Wrote in message:
>>
>>> Can I make it that if
>>
>>> C = int(sys.argv[3])
>>
>>> But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1
>>
>>>
>>
>>
>>
>> Why do you ask for 'automatically'? You're the programmer,  write
>>
>>   the test in the code.
>>
>>
>>
>> if len (sys.argv) == 3:
>>
>>      sys.argv. append ("0")
>>
>>
>>
>> But of course there are lots of other things you need to check,
>>
>>   so consider all of them at the same time.
>>
>>
>>
>> --
>>
>> DaveA
>
> then i keep getting IndexError: list index out of range
> anyway to prevent it and just set the value to 0?
>

Please find a semi-decent tool to use or always follow the instructions 
for how to remove the double line spacing when using gg, thanks.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com





More information about the Python-list mailing list