Commit 181013b1 by BellCodeEditor

auto save

parent 5bd03d64
Showing with 14 additions and 4 deletions
e.png

181 KB

import wordcloud
w=wordcloud.WordCloud(background_color="pink")
w.generate('fh hf')
w.to_file()
\ No newline at end of file
from PIL import Image
import numpy
import jieba
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('e.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