Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson21-diy1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
606646a4
authored
May 13, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
d2b0617e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
.idea/workspace.xml
my_cloud.py
.idea/workspace.xml
View file @
606646a4
...
...
@@ -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=
"
tru
e"
/>
<option
name=
"IS_MODULE_SDK"
value=
"
fals
e"
/>
<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=
"16208
21162463
"
>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.bottom"
timestamp=
"16208
95504940
"
>
<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=
"16208
21162463
"
/>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.center"
timestamp=
"16208
21162463
"
>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824"
timestamp=
"16208
95504940
"
/>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.center"
timestamp=
"16208
95504940
"
>
<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=
"16208
21162463
"
/>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.left"
timestamp=
"16208
21162463
"
>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824"
timestamp=
"16208
95504940
"
/>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.left"
timestamp=
"16208
95504940
"
>
<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=
"16208
21162463
"
/>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.right"
timestamp=
"16208
21162463
"
>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824"
timestamp=
"16208
95504940
"
/>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.right"
timestamp=
"16208
95504940
"
>
<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=
"16208
21162463
"
/>
<state
width=
"1515"
height=
"210"
key=
"GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824"
timestamp=
"16208
95504940
"
/>
<state
x=
"270"
y=
"57"
key=
"SettingsEditor"
timestamp=
"1619753937072"
>
<screen
x=
"0"
y=
"0"
width=
"1536"
height=
"824"
/>
</state>
...
...
my_cloud.py
View file @
606646a4
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment