【python】词云图,超简单入门版

超简单入门版词云图:

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')

效果图:

原文地址:https://www.cnblogs.com/helenlee01/p/12617443.html