代码
import wordcloudimport 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")
图片效果