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
if type is string python
isinstance(s, str)
python check if string in string
if "blah" not in somestring:
continue
python check if string
type('hello world') == str
# output: True
type(10) == str
# output: False
how to check a string in if statement python
if var in ('stringone', 'stringtwo'):
dosomething()