Commit f696235c by BellCodeEditor

save project

parent a197919e
from PIL import Image
import numpy
image = Image.open('6x2.png')
print(image)
value=numpy.array(image)
print()
\ No newline at end of file
import wordcloud
from PIL import Image
import numpy
import jieba
with open('python二级考试大纲.txt','r',encoding='utf-8') as f:
w=f.read()
w0=f.read()
w=wordcloud.WordCloud(background_color='white',font_path='STKAITI.TTF')
w.generate(w)
w1 = jieba.lcut(w0)
w2 = ' '.join(w1)
image = Image.open('bell.png')
stop = ['必选','表示','定义','基本的']
data=numpy.array(image)
cl=wordcloud.ImageColorGenerator(data)
w=wordcloud.WordCloud(background_color='white',font_path='STKAITI.TTF',
mask=data,color_func=cl,
stopwords=stop,max_font_size=60)
w.generate(w0)
w.to_file('wordclor.png')
\ No newline at end of file
周深1.png

74.6 KB

熊二.jpg

7.46 KB

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