Answers for "remove words from set if in list python site:stackoverflow.com"

0

remove words from set if in list python site:stackoverflow.com

query = 'What is hello'
stopwords = ['what', 'who', 'is', 'a', 'at', 'is', 'he']
querywords = query.split()

resultwords  = [word for word in querywords if word.lower() not in stopwords]
result = ' '.join(resultwords)

print(result)
Posted by: Guest on September-15-2020

Code answers related to "remove words from set if in list python site:stackoverflow.com"

Python Answers by Framework

Browse Popular Code Answers by Language