Commit 606646a4 by BellCodeEditor

auto save

parent d2b0617e
Showing with 21 additions and 17 deletions
......@@ -25,17 +25,17 @@
</component>
<component name="RunManager">
<configuration name="my_cloud" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="level3-lesson21-diy1" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="SDK_HOME" value="C:\Users\yd\AppData\Local\Programs\Python\Python37\python.exe" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<module name="" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/my_cloud.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
......@@ -63,22 +63,22 @@
<servers />
</component>
<component name="WindowStateProjectService">
<state width="1515" height="210" key="GridCell.Tab.0.bottom" timestamp="1620821162463">
<state width="1515" height="210" key="GridCell.Tab.0.bottom" timestamp="1620895504940">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="210" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1620821162463" />
<state width="1515" height="210" key="GridCell.Tab.0.center" timestamp="1620821162463">
<state width="1515" height="210" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1620895504940" />
<state width="1515" height="210" key="GridCell.Tab.0.center" timestamp="1620895504940">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="210" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1620821162463" />
<state width="1515" height="210" key="GridCell.Tab.0.left" timestamp="1620821162463">
<state width="1515" height="210" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1620895504940" />
<state width="1515" height="210" key="GridCell.Tab.0.left" timestamp="1620895504940">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="210" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1620821162463" />
<state width="1515" height="210" key="GridCell.Tab.0.right" timestamp="1620821162463">
<state width="1515" height="210" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1620895504940" />
<state width="1515" height="210" key="GridCell.Tab.0.right" timestamp="1620895504940">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state width="1515" height="210" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1620821162463" />
<state width="1515" height="210" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1620895504940" />
<state x="270" y="57" key="SettingsEditor" timestamp="1619753937072">
<screen x="0" y="0" width="1536" height="824" />
</state>
......
import wordcloud
m = wordcloud.WordCloud(background_color='white',font_path='SimHei.ttf')
with open('python二级考试大纲.txt','a',encoding='utf-8') as f:
text=f.write('贝尔编程')
# m.generate(text)
# m.to_file('mycloud.png')
\ No newline at end of file
from PIL import Image
import numpy
with open('python二级考试大纲.txt','r',encoding='utf-8') as f: #打开txt文件
text = f.read()
img = Image.open('bell.png') #打开贝尔图片
date = numpy.array(img) #获取图片的像素数组
m = wordcloud.WordCloud(background_color='white',font_path='SimHei.ttf',mask=date) #词云的内容
m.generate(text)
m.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