You can use the in operator:
if “blah” not in somestring:
If it’s just a substring search you can use string.find(“substring”).
You do have to be a little careful with find, index, and in though, as they are substring searches. In other words, this:
s = “This be a string”
if s.find(“is”) == -1:
print(“No ‘is’ here!”)
print(“Found ‘is’ in the string.”)
It would print Found ‘is’ in the string. Similarly, if “is” in s: would evaluate to True. This may or may not be what you want.