Python类方法和实例对象的方法

class	Person:

    def say_hi(self):
        print('Hello, how are you?')
        
p = Person()
p.say_hi()         #这里不能由引号
Person.say_hi('')    #缺引号会提示错误

猜你喜欢

转载自blog.csdn.net/oAlevel/article/details/79273940
今日推荐