“Python Verifique se a string contém símbolos” 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

python se string contém char

myString = "<text contains this>"
myOtherString = "AnotherString"

# Casting to string is not needed but it's good practice
# to check for errors 

if str(myString) in str(myOtherString): 
    # Do Something
else:
	# myOtherString didn't contain myString
    
Av3

Python Verifique se a string contém substring

string = "My favourite programming language is Python"
substring = "Python"

if substring in string:
    print("Python is my favorite language")
elif substring not in string:
    print("Python is not my favourite language")
micheal d higgins left nut

Python Verifique se a string contém símbolos

any(not c.isalnum() for c in string)
MitchAloha

Respostas semelhantes a “Python Verifique se a string contém símbolos”

Perguntas semelhantes a “Python Verifique se a string contém símbolos”

Mais respostas relacionadas para “Python Verifique se a string contém símbolos” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código