sys.argv and while loop

Kragen Sitaker kragen at pobox.com
Tue May 14 02:26:02 EDT 2002


"Mark Hadfield" <m.hadfield at niwa.co.nz> writes:
> One other comment: instead of string.atoi(value) you can use
> int(value). It makes little difference in this case because the
> elements of sys.argv are guaranteed to be strings, but in another
> situation you want to allow the possibility that the value is
> already an integer, or some other non-string type that can be
> converted to an integer.

>From 2.1 string.py (with irrelevant code removed):
# for a bit of speed
_int = int
def atoi(s , base=10):
    return _int(s, base)




More information about the Python-list mailing list