代码
import wordcloud
import jieba
f=open("gcd宣言.txt","r",encoding="utf-8")
t=f.read()
f.close()
txt=" ".join(jieba.lcut(t))
w=wordcloud.WordCloud(font_path="msyh.ttc",width=1000,height=700,max_words=15)
w.generate(txt)
w.to_file(" gcd宣言.png")
图片效果
代码
import wordcloud
import jieba
f=open("gcd宣言.txt","r",encoding="utf-8")
t=f.read()
f.close()
txt=" ".join(jieba.lcut(t))
w=wordcloud.WordCloud(font_path="msyh.ttc",width=1000,height=700,max_words=15)
w.generate(txt)
w.to_file(" gcd宣言.png")
图片效果