With the startswith()
and endswith()
functions it is possible to pass a tuple of strings, where if there is a match on any element the result is returned True
e.g.,:
text_to_find = ("string_1", "string2")
test = "string_to_look_in"
if test.startswith(text_to_find ) == True:
print ("starts with one of the strings")
Is there a similar command, that will work with tuples, for finding a string in a string - i.e., one of the strings in the tuples appearing anywhere in the text. (instead of e.g., using a for loop, where individually look each item in the string).