Commit 00a62b0d by BellCodeEditor

auto save

parent 53017124
Showing with 31 additions and 0 deletions
import wordcloud
from PIL import Image
import numpy
import jieba
with open('python二级考试大纲.txt',encoding='utf-8') as file:
f=file.read()
text_list=jieba.lcut(f)
text=' '.join(text_list)
img=Image.open("bell.png")
data=numpy.array(img)
img_colors=wordcloud.ImageColorGenerator(data)
ci=['的','python','和','索引','程序','必选']
w=wordcloud.WordCloud(background_color='white',
font_path='STXINGKA.TTF',
mask=data,
color_func=img_colors,
stopwords=ci,
max_font_size=80)
w.generate(f)
w.to_file("1.jpg")
\ No newline at end of file
a={1:2,'2':3,'3':4,'1':3}
print(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