python class 静态方法

‘’’ 类的静态方法 ‘’’ class Person(): @staticmethod def shoestyle(): print(‘有无数种’) if name == ‘main’: A = Person A.shoestyle() ‘’’ 使用装饰器@staticmethod 类里面的普通函数,不用传递self,cls,也可以被对象调用 ‘’’
相关文章
相关标签/搜索