Say I have a list match = ['one', 'two', 'three']
and I have a list of arguments foo = ['something', 'something_two', 'something', (...)]
I want to only do an operation on the item if it matches any of the items in the match list:
for each in foo:
for match_item in match:
if match_item not in each:
no_match = True
break
if no_match:
break
# do the desired operations
But I don't know how to make it so that it doesn't fail the match when 'something_two' comes up against 'one' and breaks all of the loops. The items in match will be only a part of the whole string in the items of foo, that's why I was looping through the list of items in match.
What would be a good way of approaching this?
if each in match: # do desired op?