Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #words #set #list #python
ADD COMMENT
Topic
Name
1+2 =