diff --git a/my_cloud.py b/my_cloud.py index 495419b..2a8891e 100644 --- a/my_cloud.py +++ b/my_cloud.py @@ -1,14 +1,17 @@ import wordcloud from PIL import Image -import numpy +import numpy +import jieba + with open("Python二级考试大纲.txt", "r",encoding='utf-8') as file: text=file.read() img = Image.open("bell.png") data=numpy.array(img) img_colors=wordcloud.ImageColorGenerator(data) -w=wordcloud.WordCloud(background_color="white",font_path='SimHei.ttf',mask=data,color_func=img_colors) +stopwords=["的","python","和","基本","程序"] +w=wordcloud.WordCloud(background_color="white", + font_path='SimHei.ttf', + mask=data,color_func=img_colors, + stopwords=stopwords,max_font_size=60) w.generate(text) w.to_file("mycloud.png") - -#value=np.array(img) -#print(value) \ No newline at end of file diff --git a/mycloud.png b/mycloud.png index f95a22c..057f807 100644 Binary files a/mycloud.png and b/mycloud.png differ