Commit 4b52e743 by BellCodeEditor

save project

parent a8108957
Showing with 4 additions and 1 deletions
...@@ -6,6 +6,8 @@ with open("python二级考试大纲.txt","r",encoding="utf-8")as f: ...@@ -6,6 +6,8 @@ with open("python二级考试大纲.txt","r",encoding="utf-8")as f:
a=f.read() a=f.read()
img=Image.open("bell.png") img=Image.open("bell.png")
data=numpy.array(img) data=numpy.array(img)
w=wordcloud.WordCloud(background_color="blue",font_path="SimHei.ttf") img_color=wordcloud.ImageColorGenerator(data)
w=wordcloud.WordCloud(background_color="blue",font_path="SimHei.ttf"
mask=data,color_func=img_color)
w.generate(a) w.generate(a)
w.to_file("j.png") w.to_file("j.png")
\ No newline at end of file
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