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庫