I have a list of html elements that have some text. I need to find the elements that have all the words I am going to supply. I have some code that accomplished what I want but I am sure there is a better way to do this
myWords=['some', 'supplied','words']
theTextContents='a string that might or might not have all of some supplied words'
goodElements=[]
count=0
for word in myWords:
if word in TheTextContents:
count+=1
if count==len(myWords):
goodElements.append(theTextContents)
There is a lot more code but this is the basic way we are testing to see if all of the words in MyWords are in theTextContent. It seems to me that this is too clunky to be good Python code
Any insights would be greatly appreciated
allfunction in Python 2.5+