If you have a tuple of strings and you want to search for a particular string, You can use the in operator.
example
tpl = ("Hello", "world", "Foo", "bar") print("world" in tpl)
Output
This will give the output −
True
Example
If you want to check if there is a substring present. You can loop over the tuple and find it using:
tpl = ("Hello", "world", "Foo", "bar") for i in tpl: if "orld" in i: print("Found orld in " + i )
Output
This will give the output −
Found orld in world