Commit f4f88edf by BellCodeEditor

save project

parent 31c95f7a
Showing with 3 additions and 2 deletions
......@@ -6,7 +6,7 @@ import jieba
with open('python二级考试大纲.txt',encoding='utf-8') as f:
text=f.read()
t_l=jieba.lcut(text)
text='',join('bell.png')
text=" ".join(t_l)
img=Image.open('bell.png')
......@@ -14,7 +14,7 @@ data=numpy.array(img)
i_c=wordcloud.ImageColorGenerator(data)
s=['的','python','和','基本','程序']
w=wordcloud.WordCloud(background_color='white',font_path='SimHei.ttf',mask=data,color_func=s)
w=wordcloud.WordCloud(background_color='white',font_path='SimHei.ttf',mask=data,color_func=i_c,stopwords=s,max_font_size=60)
w.generate(text)
w.to_file('mycloud.png')
\ No newline at end of file

216 KB | W: | H:

210 KB | W: | H:

mycloud.png
mycloud.png
mycloud.png
mycloud.png
  • 2-up
  • Swipe
  • Onion skin
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