How to check if a string "is" an int?

Grant Edwards grante at visi.com
Thu Dec 22 11:07:29 EST 2005


On 2005-12-21, Antoon Pardon <apardon at forel.vub.ac.be> wrote:

>> 15 is not a digit. 1 is a digit. 5 is a digit. Putting them together to
>> make 15 is not a digit.
>
> So? the isdigit method tests whether all characters are digits.
>
>>>> '15'.isdigit()
> True

But that is "obviously" wrong, since '15' is not a digit.

-- 
Grant Edwards                   grante             Yow!  I'm in LOVE with
                                  at               DON KNOTTS!!
                               visi.com            



More information about the Python-list mailing list