how to check if value is a number in python code example
Example 1: python check if number
if type(variable) == int or type(variable) == float:
isNumber = True
Example 2: is number python
var.isdigit()
#return true if all the chars in the string are numbers
#return false if not all the chars in the string are numbers
Example 3: check if a string is float python
try:
float(element)
except ValueError:
print "Not a float"