Commit f95475c6 by BellCodeEditor

auto save

parent 0bd66945
Showing with 9 additions and 3 deletions

232 KB | W: | H:

259 KB | W: | H:

1.png
1.png
1.png
1.png
  • 2-up
  • Swipe
  • Onion skin
import wordcloud
from PIL import Image
import numpy
import jieba
img=Image.open("bell.png")
data=numpy.array(img)
img_colors=wordcloud.ImageColorGenerator(data)
w=wordcloud.WordCloud(background_color=(0,0,0),
font_path='SIMKAI.TTF',
mask=data,color_func=img_colors)
f=open("python二级考试大纲.txt","r",encoding="utf-8")
t123=f.read()
w=w.generate(t123)
# stopwords=stopwords,max_font_size=60)
f=open("C:\\Users\EDY\\Documents\\level3-lesson21-diy3\\python二级考试大纲.txt","r",encoding="utf-8")
t1=f.read()
text_a=jieba.lcut(t1)
w=w.generate(t1)
w=w.to_file("1.png")
f.close()
# text_a=jieba.lcut(t123)
# print(text_a)
\ 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