模块化

  • 模块名和文件名同名
  • import module_name
    • 调用 module_name.function_name()
  • from module_name import childsection as othername
  • from module_name import * 导入所有函数

1
2
3
4
5
6
class Dog(父类):
def _init_(self): #构造函数
··· #self是c++里的*this
super._init_() #构造父类

dog=Dog() #创建实例