Vote count:
0
Being a beginner at both programming and Python, I am nearly going crazy over this. I have been trying to read up, and have been googling like mad, but still it seems as if I am doing some basic and crucial mistake here.
I simply want to iterate through a number of lines (containing text) and return only those lines that contain two or more of the words in a list of keywords.
I have been trying with making the wordlist and keywordlist into sets to use the intersect function, like:
if len(set(line).intersection(set(keywords))) >1:
print line
Also tried with various types of nested loops like
if word in line
But no success yet. Sorry for taking up your time with this. But I have made several honest attempts at this, so I am reaching out.
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire