Python Check if a String Contains a Substring
Given a string, determine whether the specified substring exists in the string.
Examples
def check(string, sub_str):
if (string.find(sub_str) == -1):
print("Does not exist!")
else:
print("Exists!")
string = "www.example.com"
sub_str ="example"
check(string, sub_str)
Executing the above code produces the output:
Exists!Other Extensions