import wordcloud import jieba text = open("加油鼓劲. txt", encoding='utf-8). readO seg_ generator = jieba. cut(text) seg_ list = "'. join(seg_ generator) w = wordcloud. WordCloud( font path = 'SourceHanSans-Normal. otf, stopwords=("的", "能", "和", "是","没有","了","不"]) w. generate(seg_ list) w. to_ file('加油鼓劲. png) print(词云图生成成功! ) |