继承:单继承,多继承

方法: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]

Python学习笔记05的更多相关文章

  1. python学习笔记05:贪吃蛇游戏代码

    贪吃蛇游戏截图: 首先安装pygame,可以使用pip安装pygame: pip install pygame 运行以下代码即可: #!/usr/bin/env python import pygam ...

  2. Python学习笔记(十一)

    Python学习笔记(十一): 生成器,迭代器回顾 模块 作业-计算器 1. 生成器,迭代器回顾 1. 列表生成式:[x for x in range(10)] 2. 生成器 (generator o ...

  3. Python学习笔记,day5

    Python学习笔记,day5 一.time & datetime模块 import本质为将要导入的模块,先解释一遍 #_*_coding:utf-8_*_ __author__ = 'Ale ...

  4. Deep learning with Python 学习笔记(10)

    生成式深度学习 机器学习模型能够对图像.音乐和故事的统计潜在空间(latent space)进行学习,然后从这个空间中采样(sample),创造出与模型在训练数据中所见到的艺术作品具有相似特征的新作品 ...

  5. 机器学习实战(Machine Learning in Action)学习笔记————05.Logistic回归

    机器学习实战(Machine Learning in Action)学习笔记————05.Logistic回归 关键字:Logistic回归.python.源码解析.测试作者:米仓山下时间:2018- ...

  6. Python学习笔记:装饰器

    Python 装饰器的基本概念和应用 代码编写要遵循开放封闭原则,虽然在这个原则是用的面向对象开发,但是也适用于函数式编程,简单来说,它规定已经实现的功能代码不允许被修改,但可以被扩展,即: 封闭:已 ...

  7. python 学习笔记 12 -- 写一个脚本获取城市天气信息

    近期在玩树莓派,前面写过一篇在树莓派上使用1602液晶显示屏,那么可以显示后最重要的就是显示什么的问题了. 最easy想到的就是显示时间啊,CPU利用率啊.IP地址之类的.那么我认为呢,假设可以显示当 ...

  8. Python学习笔记(四)函数式编程

    高阶函数(Higher-order function) Input: 1 abs Output: 1 <function abs> Input: 1 abs(-10) Output: 1 ...

  9. python学习笔记整理——字典

    python学习笔记整理 数据结构--字典 无序的 {键:值} 对集合 用于查询的方法 len(d) Return the number of items in the dictionary d. 返 ...

随机推荐

  1. Ubuntu自定义服务

    1.准备脚本 准备好一个bash服务脚本,包括start|stop|restart等参数,将脚本文件命名为“服务名”,拷贝到/etc/init.d/目录下. 2.添加服务sudo update-rc. ...

  2. Index on DB2 for z/OS: DB2 for z/OS 的索引

    可以创建在任何表上的索引: Unique Index:An index that ensures that the value in a particular column or set of col ...

  3. 动手动脑之小程序:TryAndCatch

    源代码 import java.util.InputMismatchException;import java.util.Scanner;public class TryAndCatch {publi ...

  4. Android -- getQuantityString无效

    原文:http://www.xuebuyuan.com/1510993.html 原因:中文没有复数语法.

  5. Android Programming: Pushing the Limits -- Chapter 4: Android User Experience and Interface Design

    User Stories Android UI Design 附加资源 User Stories: @.通过写故事来设计应用. @.每个故事只关注一件事. @.不同的故事可能使用相同的组件,因此尽早地 ...

  6. 查看当前文件系统 df -lhT -B G

    [root@ok-T test]# df -lhT -B G Filesystem Type 1G-blocks Used Available Use% Mounted on /dev/mapper/ ...

  7. Linq学习笔记---Linq to Xml操作

    LINQ to XML的成员, 属性列表: 属性 说明 Document 获取此 XObject 的 XDocument  EmptySequence  获取空的元素集合  FirstAttribut ...

  8. Java系列笔记(3) - Java 内存区域和GC机制

    目录 Java垃圾回收概况 Java内存区域 Java对象的访问方式 Java内存分配机制 Java GC机制 垃圾收集器 Java垃圾回收概况 Java GC(Garbage Collection, ...

  9. Unity依赖注入使用

    构造器注入(Constructor Injection):IoC容器会智能地选择选择和调用适合的构造函数以创建依赖的对象.如果被选择的构造函数具有相应的参数,IoC容器在调用构造函数之前会自定义创建相 ...

  10. ytu 1067: 顺序排号(约瑟夫环)

    1067: 顺序排号 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 31  Solved: 16[Submit][Status][Web Board] ...