import jieba from wordcloud import WordCloud fo=open("D:/Python/作业9(2021.4.12)/白鹿原.txt",\ "r+",encoding="utf-8") ls=jieba.lcut(fo.read()) lc="".join(ls) wordcloud=WordCloud (background_color="white",\ width=800,\ height=600,\ font_path="msyh.ttc",\ max_words=200,\ max_font_size=80,\ ).generate(lc) wordcloud.to_file("白鹿原词云1.png")

浙公网安备 33010602011771号