тест на python, ако броят на ред
>>> def hasNumbers(inputString):
... return any(char.isdigit() for char in inputString)
...
>>> hasNumbers("I own 1 dog")
True
>>> hasNumbers("I own no dog")
False
ако тип низ python
isinstance(s, str)
python проверява дали низ е в ред
if "blah" not in somestring:
continue
python проверява дали низ
type('hello world') == str
# output: True
type(10) == str
# output: False
как да се провери ред в оператора if python
if var in ('stringone', 'stringtwo'):
dosomething()