Avoiding "invalid literal for int()" exception

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Dec 12 05:11:55 EST 2006


Marc 'BlackJack' Rintsch ha escrito:

> In <mailman.1415.1165879866.32031.python-list at python.org>, Gabriel
> Genellina wrote:
>
> > elif uniList[0].isdigit():
>
> The last does not work.  Not only that it accepts numbers greater than 9
> because it checks if the whole string consists of digits, it also accepts
> u'²₂' and other unicode digits.

Oh, I didn't know that last part! Thanks.
I get a bit confused by the [0], thinking it was checking a single
character.

-- 
Gabriel Genellina




More information about the Python-list mailing list