excludes={"说道","分节阅读","说","笑道","说着","宝玉听了","一面说","贾母笑道",
"手机电子书","大学生阅读网","大学生小说网","更新时间","本章字数",
"正说着","袭人道","宝玉笑道","说毕"}
t = f.read( )
f. close( )
#分词模式
ls = jieba.lcut(t)
txt ="".join(ls)
W = wordcloud.WordCloud(font_path = "msyh.ttc",
width = 1000, height = 700,
background_color = "white",
max_words=9,
stopwords=excludes,
mask=mk)
W. generate(txt)
W.to_file( "词云.png")
https://blog.csdn.net/you7110/article/details/124872346
参考这个就行