import jieba from nltk import * from wordcloud import WordCloud import matplotlib.pyplot as plt words = [] with open('对共享单车的看法.txt', 'r') as f: for line in f.readlines(): seg_list = jieba.cut(line, cut_all=False) for w in seg_list: words.append(w) f.