Python--类-例子
2015-12-11 21:07
417 查看
class Base: def __init__(self): self.data = [] def add(self, x): self.data.append(x) def addtwice(self,x): self.add(x) self.add(x) class Child(Base): def plus(self, a, b): return a+b oChild = Child() oChild.add("Str1") print(oChild.data) print(oChild.plus(2, 3))
相关文章推荐
- 常见的python的unitest用法
- Python 一行命令ftp服务器
- Python赋值语句与深拷贝、浅拷贝的区别
- Python: 消除print的自动换行
- python练习
- python 基本数据类型
- Python调用DLL
- python练习
- python strip()函数
- Robot自定义python关键字库通过ice中间件调用服务进行API测试
- 零基础入门学习Python(7):元组
- python安装以及配置Numpy和Scipy模块
- python学习---列表
- 第二个UI脚本--Python+selenium之unittest+HTMLtestRunner及python的继承
- 深入源码解析Python中的对象与类型
- python对象类型
- python 写三级菜单
- python 读取文件指定某行
- Python中web.py运行后窗口显示中文
- Python多线程学习