关键字:@classmethod
class TEST:
@classmethod #类方法声明
def test(cls): #cls,class的缩写。必须存在,类似于普通方法中的self
print('classmethod test')
#类方法,保存在类中,通过类调用类方法
例 子:TEST.test()
关键字:@classmethod
class TEST:
@classmethod #类方法声明
def test(cls): #cls,class的缩写。必须存在,类似于普通方法中的self
print('classmethod test')
#类方法,保存在类中,通过类调用类方法
例 子:TEST.test()