On Fri, Oct 14, 2011 at 6:05 PM, Chris Angelico <ros...@gmail.com> wrote:
> 2011/10/15 惜悯 <wa...@qq.com>:
>> retrun True if type(i) is int else False
>
> That tests if the object is already an int; the OP asked if a string
> contains an integer.

Additionally:
* the if-then-else there is unnecessary since `type(i) is int` already
returns a bool
* such a type test is normally and better written `isinstance(i, int)`

Cheers,
Chris R.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to