上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 61 下一页
摘要: https://www.cnblogs.com/kex1n/p/5991249.html https://blog.csdn.net/wwx890208/article/details/80534453 __init__()有一个参数self,该self参数就是__new__()返回的实例(原来__ 阅读全文
posted @ 2019-01-27 22:56 心媛意码 阅读(327) 评论(0) 推荐(0) 编辑
摘要: arg对应多出来的位置参数,把它们解析成tuple;kwargs把关键字参数解析成dict. 文章参考:https://www.jianshu.com/p/e0d4705e8293 阅读全文
posted @ 2019-01-27 13:36 心媛意码 阅读(343) 评论(0) 推荐(0) 编辑
摘要: sorted中的lambda函数所表示的内容就是排序的依据(key) 发现list.sort()返回None,而sorted(list)能够返回排好序的列表. 阅读全文
posted @ 2019-01-20 21:34 心媛意码 阅读(3096) 评论(0) 推荐(0) 编辑
摘要: map:对指定序列做映射 python3中的: map(lambda x, y: x + y, [1, 3, 5, 7, 9], [2, 4, 6, 8, 10]) lambda 形参:返回值 实参 再如: a = {'1': ['88.12', '28100', '23'], '8': ['88. 阅读全文
posted @ 2019-01-20 21:15 心媛意码 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 函数原型: name:str类型 default:如果不存在name属性,设置default则返回default,不设置返回AttributeError. __getattr__是类的内置方法,当找不到某个属性时会调用该方法;找到就不会调用. getattr与类无关. 一个例子:作为data的代理类 阅读全文
posted @ 2019-01-18 20:31 心媛意码 阅读(4639) 评论(1) 推荐(1) 编辑
摘要: 在Python中,None、空列表[]、空字典{}、空元组()、0等一系列代表空和无的对象会被转换成False。除此之外的其它对象都会被转化成True。 1.0等于False,这点要注意. 2.空的list判断: if 0 == len(list) 或者 if list #空的list相当于Fals 阅读全文
posted @ 2019-01-16 13:18 心媛意码 阅读(751) 评论(0) 推荐(0) 编辑
摘要: %s 可以按收任何类型( 数字对应字符串);也可以接收列表; %d:只接收数字 '%.2f' % float_var: 保留两位小数(此时处理完仍为字符串类型) https://www.cnblogs.com/nulige/p/6115793.html 阅读全文
posted @ 2019-01-14 14:47 心媛意码 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 用来暴露接口 控制 from xxx import * 的行为 代码中当然是不提倡用 from xxx import * 的写法的,但是在 console 调试的时候图个方便还是很常见的。如果一个模块 spam 没有定义 __all__,执行 from spam import * 的时候会将 spa 阅读全文
posted @ 2019-01-13 22:38 心媛意码 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 以字典的形式返回当前位置的全局变量 阅读全文
posted @ 2019-01-13 22:33 心媛意码 阅读(137) 评论(0) 推荐(0) 编辑
摘要: cal = Caculator(1, 2) Caculator.class_info() cal.class_info() Caculator.static_show(3, 4) cal.static_show(3, 4) 阅读全文
posted @ 2019-01-13 22:12 心媛意码 阅读(6098) 评论(0) 推荐(2) 编辑
上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 61 下一页