python 4 数据库

1 类 面向对象

面向对象 定义和术语(Definitions and Terminology)

class 类: template 模板样板,shape of instance
method 方法: 定义类的能力
field or attribute 属性: 类重的数据
object/instance: 类中特定、具体的例子
constructor : 构造器,当实例被创造
inheritance: 基于父类扩展子类的属性

举例:动物: 方法party
dir(): 去找到方法

class Animal:   # Animal 模板
    x = 0   # 每一个动物都有的变量

    def party(self):    # 方法
        self.x = self.x + 1
        print("So :", self.x)

an = Animal()
an.party()
an.party()
an.party()
#So : 1
#So : 2
#So : 3

Inheritance 继承

创建一个新类,可以对代码重新使用。称原码为父类,新类为子类

相关数据库饿SQL

目标学习:SQL语言
database : 包含许多图标tables
relation/table: tuples and attributes 包含元组和属性
Tuple/row: 行,代表一个实列 object
Attribute/column: 列,对应行的数据
python 4 数据库_第1张图片

SQL Structured Query Language

作用:创建表、retrieve取回数据、插入数据,删除数据

数据库: Oracle MySql SqlServer
选择 SQLite 轻量级数据库
数据库参考代码

你可能感兴趣的:(python,python)