“String Python nie zawiera” Kod odpowiedzi

Jeśli nie podłoże w Pythonie String

fullstring = "StackAbuse"
substring = "tack"

if fullstring.find(substring) != -1:
    print "Found!"
else:
    print "Not found!"
riffrazor

Jeśli nie podłoże w Pythonie String

>>> string = "Hello World"
>>> # Check Sub-String in String
>>> "World" in string
True
>>> # Check Sub-String not in String
>>> "World" not in string
False
peamdev

String Python nie zawiera

str = '£35,000 per year'
# check for '£' character in the string
'£' not in str
# >> False
'£' in str
# >> True 
Worrisome Wallaby

Odpowiedzi podobne do “String Python nie zawiera”

Pytania podobne do “String Python nie zawiera”

Więcej pokrewnych odpowiedzi na “String Python nie zawiera” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu