词云作业
代码
from wordcloud import WordCloud
import matplotlib.pyplot as plt
f = open('../txt/wordcloud.txt', 'r').read()
wordcloud = WordCloud(background_color="white",width=1000,height=860,margin=2).generate(f)
plt.imshow(wordcloud)
plt.axis("off")
plt.show()
wordcloud.to_file('../picture/example1.png')

浙公网安备 33010602011771号