上面代码中使用的是 #cell-3 from wordcloud import WordCloud fontpath='SourceHanSansCN-Regular.otf' wc = WordCloud 修改cell-3,读取图片并增加mask参数: #cell-3 from wordcloud import WordCloud fontpath='SourceHanSansCN-Regular.otf -1]+$') words = [w for w in words if pattern.match(w)] cuted = ' '.join(words) print(cuted[:500]) #cell
table>
table>