python實例方法、類方法和靜態方法

class Foo(object): def test(self):#定義了實例方法 print("object") @classmethod def test2(cls):#定義了類方法 print("class") @staticmethod def test3():#定義了靜態方法
相關文章
相關標籤/搜索