静态方法

class Person:

    @staticmethod # 静态方法
    def yue():
        print("fsadf")


# 静态方法可以使用对象访问. 也可以使用类名访问. 但是一般推荐使用类名访问
p = Person()
p.yue()

# 推荐使用类名访问
Person.yue()

  

原文地址:https://www.cnblogs.com/work14/p/10145432.html