#coding=utf-8 import jieba. analyse stopwords=[] for word in open('stopwords.txt','r'): stopwords.append(word.strip()) article=open('1.txt','r').read() words=jieba.cut(article,cut_all=False) stayed_line="" for word in words: if word.encode("utf-8")not in stopwords: stayed_line+=word+" " print stayed_line