txt = "565543" x = txt.isnumeric() print(x) #this will print out True
txt = "565543" x = txt.isnumeric() print(x)
if type(variable) == int or type(variable) == float: isNumber = True
txt = "565543" x = txt.isnumeric() print(x) # Output True if String is all numbers
def num_there(s): return any(i.isdigit() for i in s)
>>> def hasNumbers(inputString): ... return any(char.isdigit() for char in inputString) ... >>> hasNumbers("I own 1 dog") True >>> hasNumbers("I own no dog") False