Commit 8a680038 by BellCodeEditor

auto save

parent 8e5e3531
Showing with 14 additions and 4 deletions
import wordcloud
w=wordcloud.WordCloud(background_color="pink")
w.generate("hello world")
w.to_file("")
\ No newline at end of file
from PIL import Image
import jieba
import numpy
with open("python二级考试大纲.txt","r",encoding="utf-8")as f:
text=f.read()
text_list=jieba.lcut(text)
text=" ".join(text_list)
img=Image.open("bell.png")
data=numpy.array(img)
w=wordcloud.WordCloud(background_color="pink",
font_path="SimHei.ttf",mask=data)
w.generate(text)
w.to_file("my_w.png")
\ No newline at end of file
my_w.png

205 KB

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment