python - 执行父类中的方法
2016-06-26 17:33
246 查看
执行父类中的方法:
class C1: def f1(self): print('c1.f1') return 123 class C2(C1): def f1(self): #主动执行父类的f1方法 ret = super(C2,self).f1() print('c2.f1') return ret obj = C2() obj.f1()
out:
c1.f1
c2.f1
相关文章推荐
- Python int()函数 基础知识篇
- Python读写txt文本文件的操作方法全解析
- Python with语句及context manager
- Python-装饰器;Decorator模式
- Python 位运算及二进制基础知识
- Python实现快速排序算法及去重的快速排序的简单示例
- Python enumerate类
- Python 小练习 倒序切片
- python结合selenium获取XX省交通违章数据的实现思路及代码
- python - 类的特殊成员
- Win 10安装Python及环境变量配置
- Python的线程/进程间通讯对象分析
- python tab 自动补全
- 正则表达式进阶
- 决策树(ID3,C4.5)Python实现
- SKLEARN 库导入错误
- python - 类成员修饰符
- 理解生产者消费者模型及在Python编程中的运用实例
- Python Demo
- 批量检测链接是否存在