From 602c70d2003b9cab0671f1f21bce445f59da7cf6 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Wed, 21 Jul 2021 17:18:03 +0800 Subject: [PATCH] auto save --- level3-lesson21-diy1.py | 11 +++++++++++ my_cloud.py | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 level3-lesson21-diy1.py diff --git a/level3-lesson21-diy1.py b/level3-lesson21-diy1.py new file mode 100644 index 0000000..66e984b --- /dev/null +++ b/level3-lesson21-diy1.py @@ -0,0 +1,11 @@ +import wordcloud + +with open('python二级考试大纲.txt', encoding='utf-8') as f: + text = f.read() +# 创建词云对象 +w=wordcloud.WordCloud(background_color="white", + font_path='SimHei.ttf') +# 传入词云文本内容 +w.generate(text) +# 保存为png图片 +w.to_file("mycloud.png") \ No newline at end of file diff --git a/my_cloud.py b/my_cloud.py index 09911f2..b3f7f65 100644 --- a/my_cloud.py +++ b/my_cloud.py @@ -1 +1,2 @@ -import wordcloud \ No newline at end of file +import wordcloud + -- libgit2 0.25.0