类方法, 实例方法, 静态方法
class A(object):
tiao = "类属性"
def sing(self,name):
self.name = name
return self.name
@classmethod
def hang(cls,*args):
return args
@staticmethod
def run():
return '静态方法'
x = A()
print(x)
print(x.tiao)
print(x.sing('实例方法'))
print(x.hang('类方法'))
print(x.run())
print('--------------------------')
print(A.tiao)
print(A.sing('实例方法'))
print(A.run())
print(A.hang('类方法'))