Commit 4df9cbc2 by BellCodeEditor

auto save

parent b85956e2
Showing with 7 additions and 3 deletions
......@@ -5,11 +5,14 @@ import jieba
with open('python二级考试大纲.txt',encoding='utf-8')as f:
text=f.read()
text_list=jieba.lcut(text)
text=" ".join(text_list)
img = Image.open("alice.png")
date = numpy.array(img)
img_colors=wordcloud.ImageColorGenerator(date)
w=wordcloud.WordCloud(background_color="blue",font_path="MSYHBD.TTC",
mask=date,color_func=img_colors)
a=["的","基本","和"]
w=wordcloud.WordCloud(background_color="white",font_path="MSYHBD.TTC",
mask=date,color_func=img_colors,
stopwords=a,max_font_size=60,scale=30)
w.generate(text)
w.to_file("1.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