I am sure this is easy
I have a function that I would like to check a block of text from an rss feed's description. The text is returned as a sting, in this example it is article_description, I then want to check the string for any of the words in my list in this example called detect.
At the moment this is just returning False
def test(article_description):
detect = ['would','you','scale']
text = article_description.split()
print (text)
print(type(text))
print(detect)
if detect in text:
print ('Success')
else:
print ('False')
def main():
article_description = 'This is my text with the word scale in it.'
test(article_description)
if (__name__ == '__main__'):
main()
I had started with this function below but that returns Exception has occurred: TypeError 'in ' requires string as left operand, not list
def test(article_description):
word = ['would','you','scale']
if word in article_description:
print ('success')