import jieba
import wordcloud
file = open(“三国演义.txt”, “r”, encoding=“utf-8”)
t = file.read()
file.close()
ls = jieba.lcut(t)
txt = " ".join(ls)
w = wordcloud.WordCloud(
width=1000, height=700,
background_color=“white”,
font_path=“msyh.ttc”
)
w.generate(txt)
w.to_file(“2.png”)
版权归原作者 m0_61921127 所有, 如有侵权,请联系我们删除。