摘要: 参考:https://www.cnblogs.com/alex3714/articles/5248247.html 提高:http://www.cnblogs.com/alex3714/articles/5876749.html selectors模块 https://www.cnblogs.com 阅读全文
posted @ 2019-05-03 13:57 Samuel-Leung 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 参考:https://www.cnblogs.com/chenya/p/4218761.html 阅读全文
posted @ 2019-04-30 16:42 Samuel-Leung 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 由于python没有抽象类、接口的概念,所以要实现这种功能得abc.py这个类库,具体方式如下: # coding: utf-8import abc #抽象类class StudentBase(object): __metaclass__ = abc.ABCMeta @abc.abstractmet 阅读全文
posted @ 2019-04-29 21:48 Samuel-Leung 阅读(251) 评论(0) 推荐(0) 编辑
摘要: classmethod类方法 1) 在python中.类方法 @classmethod 是一个函数修饰符,它表示接下来的是一个类方法,而对于平常我们见到的则叫做实例方法。 类方法的第一个参数cls,而实例方法的第一个参数是self,表示该类的一个实例。2) 普通对象方法至少需要一个self参数,代表 阅读全文
posted @ 2019-04-28 12:56 Samuel-Leung 阅读(5320) 评论(0) 推荐(0) 编辑
摘要: 参考:https://my.oschina.net/liuyuantao/blog/747164 python中__metaclass的详解 参考:https://www.cnblogs.com/iamswf/p/4713749.html 阅读全文
posted @ 2019-04-28 02:17 Samuel-Leung 阅读(121) 评论(0) 推荐(0) 编辑
摘要: __call__ 对象后面加括号,触发执行。 注:构造方法的执行是由创建对象触发的,即:对象 = 类名() ;而对于 __call__ 方法的执行是由对象后加括号触发的,即:对象() 或者 类()() class Foo: def __init__(self): pass def __call__( 阅读全文
posted @ 2019-04-28 01:57 Samuel-Leung 阅读(594) 评论(0) 推荐(0) 编辑
摘要: python中并没有像 C语言 C++ java 那样定义静态属性的关键字 static 那么在python中是怎么做的呢? lancelance01<__main__.A object at 0x0000000001DC84A8> 其中 name01是实例变量 这样应该清楚了 阅读全文
posted @ 2019-04-28 01:39 Samuel-Leung 阅读(2825) 评论(0) 推荐(0) 编辑
摘要: 参考:https://www.cnblogs.com/blackmatrix/p/5606364.html 阅读全文
posted @ 2019-04-28 00:57 Samuel-Leung 阅读(450) 评论(0) 推荐(0) 编辑
摘要: 参考: https://blog.csdn.net/likunkun__/article/details/81949479 阅读全文
posted @ 2019-04-27 23:51 Samuel-Leung 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 与java 不同 python支持多继承 参考:https://www.cnblogs.com/bigberg/p/7182741.html 阅读全文
posted @ 2019-04-27 12:29 Samuel-Leung 阅读(163) 评论(0) 推荐(0) 编辑