In this article, we would like to show you how to check if string doesn't contain character in Python.
text = "ABC" print("D" not in text) # True
In this example, we check if
D character is NOT present in the
text string using
text = "ABC" if "D" not in text: print("The 'D' character isn't present in the", text)
The 'D' character isn't present in the ABC