how to strip a list in python
list1 = ["a ", " b ", " c"]
[i.strip() for i in list1] # ['a', 'b', 'c']
how to strip a list in python
list1 = ["a ", " b ", " c"]
[i.strip() for i in list1] # ['a', 'b', 'c']
remove stopwords from list of strings python
from nltk.corpus import stopwords
stopwords=set(stopwords.words('english'))
data =['I really love writing journals','The mat is very comfortable and I will buy it again likes','The mousepad is smooth']
def remove_stopwords(data):
output_array=[]
for sentence in data:
temp_list=[]
for word in sentence.split():
if word.lower() not in stopwords:
temp_list.append(word)
output_array.append(' '.join(temp_list))
return output_array
output=remove_stopwords(data)
print(output)
['really love writing journals','mat comfortable buy likes', 'mousepad smooth']
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us