checking if a number is int
logistix
logstx at bellatlantic.net
Sat Apr 6 14:50:56 EST 2002
Use python's type system:
>>> import types
>>> a, b = 1, 1.0
>>> if type(a) == types.IntType: print "int"
...
int
>>> if type(b) == types.IntType: print "int"
...
>>>
--
-
"Robert Spielmann" <varial at gmx.de> wrote in message
news:Xns91E8C6EF779FEvarialgmxde at 130.133.1.4...
> Hi,
>
> is there a way in python to check if a number is integer? My problem is
> the following: I need to know if sqrt(x) is an integer value or if there
> is a fractional part.
>
> Thanks for help
> Robert Spielmann
More information about the Python-list
mailing list