继承:单继承,多继承

方法: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. supersr--打电话/短信分享/邮件分享

    //  Created by apple on 15/6/17. //  Copyright (c) 2015年 Super All rights reserved. // #import " ...

  2. 解决 The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

    这个时候我们只需要flush privileges 一下就OK了,mysql> flush privileges;Query OK, 0 rows affected (0.01 sec)

  3. Android xml text 预览属性

    只在 AS 中生效 xmlns:tools="http://schemas.android.com/tools" tools:text="I am a title&quo ...

  4. Orleans是什么 (一)

    官网:http://dotnet.github.io/orleans/ 文档:http://dotnet.github.io/orleans/What's-new-in-Orleans 源码:http ...

  5. NYOJ题目893十字架

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAsYAAAQRCAIAAACl4dlPAAAgAElEQVR4nO3dO1Ljyv834P8myFkIsR

  6. jsp 过滤器 Filter 配置

    .如果要映射过滤应用程序中所有资源: <filter>    <filter-name>loggerfilter</filter-name>    <filt ...

  7. Hbernate映射类型

    对应oracle中的数据库:用timestamp

  8. 标准BT.656并行数据结构

    转自网络,感谢原作者和转载者. 还有参考:百科http://baike.baidu.com/link?url=bqBT3S7pz_mRJoQE7zkE0K-R1RgQ6FmHNOZ0EjhlSAN_o ...

  9. tengine-2.1.0 源码安装

    [root@localhost tengine-]# yum update -y [root@localhost tengine-]# yum install gcc gcc-c++ autoconf ...

  10. CLR via C#(15)--String,熟悉而又陌生

    好久没写文章了,再拿起这本书,学习加分享,乐趣无穷啊.这两天看了写关于字符串的知识,从学写代码的时候开始,我们就基本天天跟String打交道,对它再熟悉不过了.但是仔细看看,还是有一种拨开云雾的感觉, ...