jeudi 10 septembre 2015

get matched item from generator expression

I have written an if condition with a generator expression.

if any(re.search(item.lower(), record['title'].lower()+' '+record['description'].lower()) for item in self.keyword_list):
    #for which value of item condition became true?
    #print item does not work
    print record

If condition is true, then I want to print that matching item name. How do I get this?

Aucun commentaire:

Enregistrer un commentaire