摘要: 1、基础函数: 2.参数: 两种不同的非固定参数(但都是以元祖形式打包的)传参写法: *users是吧msg之后的所有参数截胡打包给自己,后面如果加一个age,她也会把age包含里面。因此,如果后面加形参,调用时用关键参数,以age这个为例:age=22.这样的话就不会被截胡。 元祖打包和字典打包: 阅读全文
posted @ 2018-04-11 00:57 不才一首歌 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 三元运算: 文件操作: 这里的路径写法目前自己知道的有三种: 1、linux路径方法 'C:/Users/Administrator.USER-20171109UR/Desktop/新建文本文档.txt' 2、双斜杠 'C:\\Users\\Administrator.USER-20171109UR 阅读全文
posted @ 2018-04-11 00:56 不才一首歌 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 购物车程序: 退出整个程序==>>: exit('bye!') 阅读全文
posted @ 2018-04-11 00:55 不才一首歌 阅读(527) 评论(0) 推荐(0) 编辑
摘要: 1.decode和encode s.decode('utf-8').encode('utf-8') decode():是解码 encode()是编码 isinstance(s,unicode):判断s是否是unicode编码,如果是就返回true,否则返回false 2.规则: 3.python 内 阅读全文
posted @ 2018-04-11 00:54 不才一首歌 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 集合介绍: 集合用法: s = {} type(s)<class 'dict'>s={1}type(s)<class 'set'>l=[1,22,36,54,1,3,2,22]set(l){1, 2, 3, 36, 54, 22}s={1,2,3,4,5,2,5}s{1, 2, 3, 4, 5}s. 阅读全文
posted @ 2018-04-11 00:54 不才一首歌 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 自己做的: 阅读全文
posted @ 2018-04-11 00:53 不才一首歌 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 一、元祖。 二、hash函数 三、数据类型-字典 创建: 方便查找: a.sort排序: 增加: 修改: 查找: 删除: pop:删除 (删除最后一个,并返回) popitem随机删 python 中range() 函数可创建一个整数列表,一般用在 for 循环中。 多级字典嵌套: 修改: info 阅读全文
posted @ 2018-04-11 00:52 不才一首歌 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 数据类型-字符串: 特性:有序和不可变 字符串可以加和乘 拼接 创建: 对于字符串,一下表示: s.capitalize()开头大写其余小写 'Helloworld!' s.casefold()全部小写 'helloworld!' s.center(50,'*')50是长度,*是填的东西 '**** 阅读全文
posted @ 2018-04-11 00:50 不才一首歌 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 自己做的: 第11题: 去括号: 第12题: 正确答案: 第13题: 第14题: 1. 阅读全文
posted @ 2018-04-11 00:48 不才一首歌 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 列表:eg 创建: name = ['x','s','d','f','g','h','j','k','l','n','c',2,3,1,6,5,1,6,1,] (索引从0开始) 查询: name.index(L)这代表列表中 L 在第几位 name[1]表示 x name[3]表示 d name[- 阅读全文
posted @ 2018-04-11 00:46 不才一首歌 阅读(144) 评论(0) 推荐(0) 编辑