政府工作报告词云
https://python123.io/resources/pye/关于实施乡村振兴战略的意见.txt
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=1000,height=700,background_color="white")
w.generate(txt)
w.to_file("grworcloud.png")
运行结果
过程中报错:ValueError: Only supported for TrueType fonts
解决方法:https://blog.csdn.net/weixin_44306095/article/details/131771185