[Tutor] why different result from two similar ways
Steven D'Aprano
steve at pearwood.info
Wed Nov 7 00:22:38 CET 2012
On 07/11/12 03:31, Prasad, Ramit wrote:
> Steven D'Aprano wrote:
>> The isdigit method doesn't only work on a single character
>> at a time, it works on an entire string:
>>
>> py> "12345".isdigit()
>> True
>> py> "12345a".isdigit()
>> False
>
> I just want to point to the OP (Frank) that this only works for "digits"
>i.e. integers. It will fail for other types of numbers.
That's why it's called "isdigit" not "isnumber" :)
--
Steven
More information about the Tutor
mailing list