fullstring = "StackAbuse"
substring = "tack"
if fullstring.find(substring) != -1:
print "Found!"
else:
print "Not found!"
>>> str = "Messi is the best soccer player"
>>> "soccer" in str
True
>>> "football" in str
False
fullstring = "StackAbuse"
substring = "tack"
if substring in fullstring:
print "Found!"
else:
print "Not found!"
fullstring = "StackAbuse"
substring = "tack"
if substring in fullstring:
print("Found!")
else:
print("Not found!")
if word in mystring:
print('success')
string = "This contains a word" if "word" in string: print("Found") else: print("Not Found")
from re import search
fullstring = "StackAbuse"
substring = "tack"
if search(substring, fullstring):
print "Found!"
else:
print "Not found!"