Note, this is not a duplicate of this question:
How to check if a string contains an element from a list in Python
However, it's based on it's logic.
I have the following string:
my_string = 'this is my complex description'
I have a list of keywords:
keywords = ['my', 'desc', 'complex']
I know I can use the following to check if the keywords exist:
if any(ext in my_string for ext in keywords):
print(my_string)
But I'd like to show which keywords actually match the description. I know I can do a loop through the keywords, and then do a check for each one individually, but is it possible in a single statement?
It doesn't matter which version of python is the solution.