I a list of strings A and a list of keywords B. Now I want to return all strings from list A which have all keywords from B in it as a new list.
def string_search(strings, keys):
res = []
for s in strings:
full = True
for k in keys:
if not(k in s):
full = False
break
if full == True:
res.append(s)
return res
In which way could I improve this code? I ask purely out of curiosity, since it works perfectly fine and it is not the bottleneck of my processing chain.