インストールライブラリ
pip install wordcloud
インストールが少し遅くなります。外国の資源ステーションからダウンロードしてください。我慢して
Wordの雲の経験 - 英語版
import wordcloud
txt = 'live is short i use python'
wc = wordcloud.WordCloud()
wc.generate(txt)
wc.to_file('test.png')
Wordの雲の中国語版
「中華の間違いました
import wordcloud
txt = '人生苦短,我用python'
wc = wordcloud.WordCloud()
wc.generate(txt)
wc.to_file('test.png')
「フォントの指定
import wordcloud
font_path = r'C:\Windows\Fonts\simhei.ttf'
txt = '人生 苦短,我用 python'
wc = wordcloud.WordCloud(font_path=font_path)
wc.generate(txt)
wc.to_file('test.png')