Commit 8ead4ffa by BellCodeEditor

save project

parent 2386d9f4
Showing with 17 additions and 0 deletions
import wordcloud
from PIL import Image
import numpy
import json
import jieba
with open('python二级考试大纲.txt',encoding="utf-8") as f:
text=f.read()
a=jieba.lcut(text)
b=" ".join(a)
img=image.open('bell.png')
data=numpy.array(img)
stopwords=["的","python","和","基本","程序"]
imgcolor=wordcloud.ImageColorGenerator(date)
wordcloud.wordCloud(background_color="black",font_path="SimHef.ttf",mask=data,color_func=imgcolor,stopwords=stopwords,max_font_size=60)
w.generate(b)
w.to_fill('wycloud.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