Commit 904b093c by BellCodeEditor

auto save

parent 6b1fbc15
1.jpg

172 KB

2.jpg

29.8 KB

File added
This diff is collapsed. Click to expand it.
center.jpg

35.2 KB

import wordcloud
\ No newline at end of file
import wordcloud
from PIL import Image
import numpy as np
import jieba
with open('python二级考试大纲.txt','r',encoding='utf-8')as file:
text=file.read()
txt_list = jieba.lcut(text)
# print(txt_list)
text = "".join(txt_list)
#读取图片
img = Image.open('center.jpg')
#将图片RGB像素转化成多维数组
data = np.array(img)
img_colors = wordcloud.ImageColorGenerator(data)
stopwords = {'的','python','和','基本','程序'}
w=wordcloud.WordCloud(background_color='white',
font_path='STXINGKA.TTF',
mask = data,
color_func= img_colors,
stopwords=stopwords,
max_font_size=50)
w.generate(text)
w.to_file('mycloud.png')
\ No newline at end of file
###基本要求
###基本要求
......@@ -52,4 +52,19 @@
单项选择题40分(含公共基础知识部分10分)
操作题60分(包括基本编程题和综合编程题)
2.考试环境
Windows7操作系统,建议 Python3.42至 Python3.53版本,IDLE开发环境。
\ No newline at end of file
Windows7操作系统,建议 Python3.42至 Python3.53版本,IDLE开发环境。
qweqw
e qweqweqw
eq
wordeloud库qw
qweqwe qweqwe
qwe
qweqwrwe
random库et
wrt
wordeloud库 random库q去微软请问rqwrqw人qwrqweqweqw
qwe去weqw额qw额q we werwerqw 认为而且我特人同意他人
微软
问题
二、基本数据类型erw er
\ No newline at end of file
import wordcloud
import wordcloud
from PIL import Image
import numpy as np
import jieba
with open('python二级考试大纲.txt','r',encoding='utf-8')as file:
text=file.read()
txt_list=jieba.lcut(text)
#print(txt.list)
text="".join(txt_list)
img=Image.open('2.jpg')
data=np.array(img)
img_colors=wordcloud.ImageColorGenerator(data)
stopwords={'的','python','和','基本','程序'}
w=wordcloud.WordCloud(background_color='white',font_path='SIMLI.TTF',mask=data,
color_func=img_colors,stopwords=stopwords,max_font_size=50)
w.generate(text)
w.to_file('mycloud.png')
\ No newline at end of file
import wordcloud
import wordcloud
from PIL import Image
import numpy as np
import jieba
with open('python二级考试大纲.txt','r',encoding='utf-8')as file:
text=file.read()
txt_list=jieba.lcut(text)
text="".join(txt_list)
img=Image.open('zuanxugao.png')
data=np.array(img)
img_colors=wordcloud.ImageColorGenerator(data)
stopwords={'的','python','和','基本','程序'}
w=wordcloud.WordCloud(background_color='white',
font_path='STXINGKA.TTF',
mask=data,
color_func=img_colors,
stopwords=stopwords,
max_font_size=50)
w.generate(text)
w.to_file('mycloud.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