#以下是写在idle中的代码
import jieba
import wordcloud
txt="从来就没有什么救世主,也不靠神仙皇帝\
我们要创造人类的幸福,全靠我们自己\
旧世界打个落花流水,奴隶们起来起来。"
w=wordcloud.WordCloud(width=1000,\
font_path="msyh.ttc",height=700)
w.generate(" ".join(jieba.lcut(txt)))
w.to_file("aaaaa.png")
下面是输出结果
Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\张子成\AppData\Local\Temp\jieba.cache
Loading model cost 0.907 seconds.
Prefix dict has been built succesfully.