xxxxxxxxxx
str_list = ["one", "two", "three"]
substr = "wo"
if any(substr in str for str in str_list):
print('Yes!')
xxxxxxxxxx
matchers = ['abc','def']
matching = [s for s in my_list if any(xs in s for xs in matchers)]
Output:
['abc-123', 'def-456', 'abc-456']
xxxxxxxxxx
extensionsToCheck = ('.pdf', '.doc', '.xls')
'test.doc'.endswith(extensionsToCheck) # returns True
'test.jpg'.endswith(extensionsToCheck) # returns False
xxxxxxxxxx
list_ = ['a','b','c']
'a' in list_ #returns True
'd' in list_ #returns False