超简单入门版词云图:
from wordcloud import WordCloud import matplotlib.pyplot as plt f = open('citu2.txt',encoding = 'utf-8').read() wd = WordCloud(background_color ='white',width = 1000,height = 1000, margin = 2).generate(f) wd.to_file('b.jpg')
效果图: