jieba和词云

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(font_path="msyh.ttc",width=100,height=700,background_color="white",)
w.generate(txt)
w.to_file("grwordcloud.png")

posted @ 2020-04-07 19:31  Lysim  阅读(158)  评论(0)    收藏  举报