摘要: 词云的生成 import wordcloud import imageio mask = imageio.imread(r"D:\python\7.17\test7.png") 导入图片 f = open(r'D:\python\z', 'r', encoding='utf8') 打开文档 data 阅读全文
posted @ 2019-07-19 15:08 oxtime 阅读(432) 评论(0) 推荐(0) 编辑
摘要: 字符串类型内置方法 1. 方法 2. 优先掌握 1. 索引取值 2. 切片 3. 长度 4. 切分split 5. 除两边空白strip 6. 成员运算in not in 7. for循环 3. 需要掌握 1. lstrip/rstrip:左/右除空白 2. rsplit:从右开始切割 3 阅读全文
posted @ 2019-07-18 20:03 oxtime 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 字符串,列表,字典的一些练习题 python 1.将以下数据存储为字典类型 数据:info = "name:Owen|age:18|gender:男" 结果:{'name': 'Owen', 'age': 18, 'gender': '男'} for i in info: a,b = i.split 阅读全文
posted @ 2019-07-18 19:58 oxtime 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 使用random库 import random random库概述 基本随机数函数:seed(), random() 扩展随机数函数:randint(), getrandbits(), uniform(),randrange(), choice(), shuffle() 基本随机函数 | 函数 | 阅读全文
posted @ 2019-07-17 19:45 oxtime 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 1. 使用while循环输出1 2 3 4 5 6 8 9 10 i =1 while i 阅读全文
posted @ 2019-07-17 16:46 oxtime 阅读(660) 评论(0) 推荐(0) 编辑
摘要: [TOC] 字符串可以表示姓名,性别 name = 'nick' print(name) name = "nick"print(name) gender = "male" 三引号中的字符串可以换行 poem = '''锄禾日当午,汗滴禾下土;谁知盘中餐,粒粒皆辛苦'' 'print(poem) po 阅读全文
posted @ 2019-07-16 17:29 oxtime 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 每一天都学习,每一天都会进步,假设你每一天进步0.001,一年之后的你 365 1.001 如果每天退步一点点 360 0.999 周一到周五进步0.01,然后双休日退步0.01,怎么计算 周一到周五努力到什么程度才能 == 每天进步0.01结果一样 阅读全文
posted @ 2019-07-16 14:36 oxtime 阅读(322) 评论(0) 推荐(0) 编辑
摘要: [TOC] 数据类型 1)整型(int) example: a = 0 b = 1 诸如此类,都为整型 2)浮点型(float) example: f = 1.1 f = 1.2 3)复数型(complex) example: c = 1+2j 4)字符串(str) 字符串不可变(修改字符串后,会生 阅读全文
posted @ 2019-07-16 10:59 oxtime 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 作业 1. 使用turtle库,绘制一个八边形。图形如下所示: 2. 使用turtle库,绘制一个八角图形。图形如下所示: 3. 简述 /`from import import as `三者的区别 import :导入模块但编写代码时每次要自己输入方法 from import :将所有的方法都导入进 阅读全文
posted @ 2019-07-16 08:19 oxtime 阅读(126) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.setup(800,600) turtle.pensize(25) turtle.pencolor('blue') turtle.penup() 抬笔 turtle.fd( 250) turtle.pendown() 落笔 turtle.seth( 40) 阅读全文
posted @ 2019-07-15 14:04 oxtime 阅读(594) 评论(0) 推荐(0) 编辑