1# check if a number is int or float
2
3isinstance(x, int) # integer
4isinstance(x, float) # float
5
6import numbers
7isinstance(x, numbers.Integral) # Long Int
8
1>>> x = 12
2>>> isinstance(x, int)
3True
4>>> y = 12.0
5>>> isinstance(y, float)
6True
7
1>>> def isFloatInteger(float):
2>>> return float.is_integer()
3>>> isFloatInteger(0.62)
4False
5>>> isFloatInteger(1.00)
6True
7