Python学习笔记05
类
继承:单继承,多继承
方法:self开头,类似C#中的this
属性:直接写变量
对象:使用类名() 构造
__init__():构造函数
#多继承 class A(object): ............. class B(object): ............. class C(A,B): class RcdBase(object): recordID = "" #类属性 def __init__(self): print 'call Rcd Base __init__'
def getRecordID(self): return self.recordID #对象属性,已self来调用 class RcdHeader(RcdBase): def __init__(self): print 'call RcdHeader __init__' return super(RcdHeader, self).__init__() CreateDate = "" CreateTime ="2015-8-6" SoftwareName = "imc" header = RcdHeader() print header.CreateTime print header.SoftwareName |
所有的非类的写法都是字面量
list的字面量是[]
__add__实际上是运算符重载的内部结构
list的方法
print dir(list) #print help(list) nl = [1,3,5,7] nl.append('pz') print nl.append(3),nl print nl.count(3) print nl.index('pz') print nl.insert(0,12), nl print nl.pop(2) print nl,nl.pop() print nl.reverse(),nl print nl.sort(),nl print [1,2,3] + [5,6,9] |
最新文章
- Maven pom文件常用配置,转载
- LUA table学习笔记
- [译]git rebase
- 转-Spring 注解学习手札(七) 补遗——@ResponseBody,@RequestBody,@PathVariable
- JavaScript高级 面向对象的程序设计 (一)《JavaScript高级程序设计(第三版)》
- DataGridView导出Excel
- 第二十九篇、UICollectionView瀑布流
- UVA 10896 Sending Email
- 允许debian wheezy支持IOS7+的iphone.
- C#中的逆变和协变
- Hibernate学习(一)创建数据表
- 个性化WinPE封装方法----制作过程需要了解的“命令”
- TRIO-basic指令--函数FUNCTION
- Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 2) A - D2
- spark streaming的有状态例子
- Java编程的逻辑 (76) - 并发容器 - 各种队列
- HTML5练习3
- 硬盘 不属于Rom RAM
- jQuery开发技巧
- BIEE11G配置Oracle 12c数据源