wordcloud库
1.定义
- wordcloud是优秀的词云展示的第三方库
2.基本使用

3.英文效果
import wordcloud c=wordcloud.WordCloud() c.generate("worldcloud by Python") c.to_file("pywordcloud.png")
![]()
python的wordcloud库wordcloud库
4.中文效果
import wordcloud import jieba txt="人生苦短,我用python" w=wordcloud.WordCloud(width=1000,font_path="msyh.ttc",height=700,background_color="white") w.generate(" ".join(jieba.lcut(txt))) w.to_file("pywcloud.png")
![]()
python的wordcloud库wordcloud库