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
943bf9ce
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
6fee5b55
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
demo1.py
my_cloud.py
new.png
demo1.py
0 → 100644
View file @
943bf9ce
import
jieba
result
=
jieba
.
lcut
(
'他来自北京大学,大学'
)
print
(
result
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
my_cloud.py
View file @
943bf9ce
import
wordcloud
from
PIL
import
Image
with
open
(
'python二级考试大纲.txt'
,
encoding
=
'utf-8'
)
as
f
:
my_text
=
f
.
read
()
my_wordcloud
=
wordcloud
.
WordCloud
(
font_path
=
'SimHei.ttf'
,
background_color
=
'white'
)
# my_wordcloud.generate('我 爱 编程 哈 什么 到底 好好学习 天天向上')
my_wordcloud
.
generate
(
my_text
)
my_wordcloud
.
to_file
(
'new.png'
)
my_image
=
Image
.
open
(
'new.png'
)
my_image
.
show
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
new.png
0 → 100644
View file @
943bf9ce
75.4 KB
This diff is collapsed.
Click to expand it.
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