摘要: 类 1 类定义 class Person: pass 2方法 类中的方法,就是函数; self代表实例本身 3初始化 __init__(self,...) 实例化之后自动被调用,以完成初始化 4 属性 私有属性 在属性前加一个下划线(_)和两个下划线(__) 每日Linux命令 find 查找 fi 阅读全文
posted @ 2018-09-16 19:40 liubosong 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 函数基础(二) 1 匿名函数 lambda 例如 filter(lambda x: x>0, list0) 2 函数作用域 L<E<G<B 3 闭包 def process_x(x): x+=1 def process_y(y): return x+y return process_y 4 递归函数 阅读全文
posted @ 2018-09-16 19:28 liubosong 阅读(77) 评论(0) 推荐(0) 编辑
摘要: 函数基础(一) 1 函数基础 return 可以返回任意表达式,但是不能是赋值语句 2 函数参数 必备参数 默认参数 不定长参数 如 def func(*args, **kwargs): pass 参数无类型,参数可以接受任意对象; 只有函数中的代码才会对参数类型有限制 参数调用 不定长参数 def 阅读全文
posted @ 2018-09-15 18:32 liubosong 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 控制流程 1 条件判断 if 判断语句1: 执行语句 elif 判断语句2: 执行语句 else : 执行语句 2 三目运算 a = 3 b = True if a > 5 else False 3 条件循环 i = 0 while i < 10: print(i) i+=1 else: (whil 阅读全文
posted @ 2018-09-15 18:10 liubosong 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 散列类型 运算符优先级和逻辑运算 1 集合 唯一性;无序性,没有索引 可变 两种定义: set() {} 四种运算 & | - ^ 增 add() update() 删除 pop() remove() 查看 issubset() issuperset() isdisjoint() 2 字典 可变;k 阅读全文
posted @ 2018-09-15 17:56 liubosong 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 1 格式化输出 %s %d %f %c %o %x %e format '{:.2f}'.fomat(12.333) '{a:.2f}'.fomat(a = 12.333) '{:.2%}'.fomat(12.333) f = 'Hello,{}'.format 把format看作函数调用 2 字符 阅读全文
posted @ 2018-09-15 15:52 liubosong 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 覆水难收。同理,上传到网上的信息也是无法彻底删除的。 Joe Garrelli,1996年3月 1 Linux常用命令 目录跳转 cd cd.. cd../.. cd- cd~ 新建文件 touch 复制文件 cp 查看 cat 删除 rm 移动 mv 创建文件夹 mkdir 删除文件夹 rmdir 阅读全文
posted @ 2018-09-15 15:08 liubosong 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Linux命令基本命令: ls(list);pwd(print work directory);cd(change directory);whoami(who am i);顾名思义 本节知识点 1 数值类型 int; float(不精确;decimal精确计算。例:decimal.Decimal(' 阅读全文
posted @ 2018-09-15 14:43 liubosong 阅读(82) 评论(0) 推荐(0) 编辑