N
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
N
yourString = "string"
if "s" in yourString:
print("There is an S in your string")
if "s" not in yourString:
print("There is no S in your string")
N
>>> str = "Messi is the best soccer player"
>>> "soccer" in str
True
>>> "football" in str
False
N
myString = "God is good"
if "o" in myString[0:4]
print("Working! There is an 'O' in between the G and D of God.")