无参数

类 / 方法

class Greeting:
    # self is the only parameter
    def say_goodbye(self):
        print("Goodbye!")

    # No parameters at all: a static method
    @staticmethod
    def say_hello():
        print("Hello!")


greeting = Greeting()
greeting.say_goodbye()

Greeting.say_hello()