python how to tell if a string is a number code example
Example 1: python check if number
if type(variable) == int or type(variable) == float:
isNumber = True
Example 2: pyton how to tell if string is a int or string
def RepresentsInt(s):
try:
int(s)
return True
except ValueError:
return False