“String python não contém” Respostas de código

Se a substring não estiver em string python

fullstring = "StackAbuse"
substring = "tack"

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

Se a substring não estiver em string python

>>> 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 não contém

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

Respostas semelhantes a “String python não contém”

Perguntas semelhantes a “String python não contém”

Mais respostas relacionadas para “String python não contém” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código