check if string in strin python code example
Example 1: python test if number in string
>>> def hasNumbers(inputString):
... return any(char.isdigit() for char in inputString)
...
>>> hasNumbers("I own 1 dog")
True
>>> hasNumbers("I own no dog")
False
Example 2: find string in string python
>>> str = "Messi is the best soccer player"
>>> "soccer" in str
True
>>> "football" in str
False