类的基本构成
1、class 类名:
def __init__(self, a): self.对象变量 = a
2、@property
def 属性方法(self): return '属性方法' def 普通方法(self): # 对象.普通方法() return '普通方法'
3、@staticmethod
def 静态方法(): # 类名.静态方法() return '静态方法'
4、@classmethod
def 类方法(cls): # 类名.类方法() return '类方法'
上一篇:python中model模块如何使用
下一篇:python中条件锁与信号量锁如何使用