python check if string is number

>>> def hasNumbers(inputString):
...     return any(char.isdigit() for char in inputString)
... 
>>> hasNumbers("I own 1 dog")
True
>>> hasNumbers("I own no dog")
False

Here is what the above code is Doing:
1. We define a function called hasNumbers that takes an input string.
2. We use a list comprehension to return True if any of the characters in the input string are digits.
3. We call the function with the string “I own 1 dog” and it returns True.
4. We call the function with the string “I own no dog” and it returns False.