Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

method for detect that a float number is integer in python

Check if object is int or float: isinstance()
Check if float is integer: is_integer()
Check if numeric string is integer:
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #method #detect #float #number #integer #python
ADD COMMENT
Topic
Name
3+9 =