python学习笔记(11)--词云

中分词库  jieba

词云 wordcloud

import jieba
import wordcloud
f = open("新时代中国特色社会主义.txt", "r", encodint="utf-8")
t = f.read()
f.close()
ls = jieba.lcut(t)
txt = " ".join(ls)
w = wordcloud.WordCloud( font_path = "msyh.ttc", \
           width = 1000, height = 700, background_color="white")
w.generate(txt)
w.to_file("wordcloud.png")

http://yciyun.com/

 

posted @ 2018-06-29 16:46  行木辛  阅读(231)  评论(0编辑  收藏  举报