Checking for Substring Presence in Python


Use the in operator to check if a substring exists within a string.

Source Code

message = "Python is awesome"
if "Python" in message:
    print("Python is mentioned")
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments