1 Star 0 Fork 0

toliong/pythonbasic

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
awordCloud.py 464 Bytes
一键复制 编辑 原始数据 按行查看 历史
toliong 提交于 2020-04-02 10:18 . add all
# encoding: utf-8
import jieba
import wordcloud
f = open("e:\\关于实施乡村振兴战略的意见.txt", 'r',encoding="utf8")
t = f.read() # t is string
f.close()
ls = jieba.lcut(t) # ls is list
txt = " ".join(ls) # txt is string
w = wordcloud.WordCloud( font_path="msyh.ttf", \
width=1000, height=700, background_color="white") # font_path="msyh.ttc",
w.generate(txt)
w.to_file("grwordcloud.png")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/toliong/pythonbasic.git
git@gitee.com:toliong/pythonbasic.git
toliong
pythonbasic
pythonbasic
master

搜索帮助