标签:pre property print turn eth code static icm sel
class A():
def walk(self): #实例方法,a = A()--a.walk()
print(‘walking ‘)
@staticmethod #静态方法, A().sta()
def sta():
print(‘static func‘)
@classmethod #类方法, A().classfunc()
def classfunc(self):
print(‘class method‘)
@property #静态属性, a = A()--a.pro
def pro(self):
return ‘property func‘
def __privatefunc(self):#私有方法,只有内部访问
print(‘私有方法‘)
def forprivatefunc(self): #内部访问私有方法
return self.__privatefunc()
标签:pre property print turn eth code static icm sel
原文地址:https://www.cnblogs.com/cou1d/p/13070282.html