Flag control variable

luke.geelen at gmail.com luke.geelen at gmail.com
Wed Feb 12 10:32:29 EST 2014


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?



More information about the Python-list mailing list