wordcloud 失眠飞行

import jieba
import wordcloud

f = open("失眠飞行.txt", "r", encoding="utf-8")

t = f.read()
f.close()
ls = jieba.lcut(t)

txt = " ".join(ls)
w = wordcloud.WordCloud(width=800, height=750, background_color="pink", font_path="msyh.ttc")
w.generate(txt)
w.to_file("grwordcloud.png")

posted @ 2021-04-24 23:05  xrccccc  阅读(73)  评论(0)    收藏  举报