问答详情
源自:4-8 python中定义实例方法

为什么不是Person.score,而是self.score呢??

https://img.mukewang.com/5d5039ad0001132604040418.jpg为什么这里不是Person.score,而是self.score呢??

提问者:JeniferLuo 2019-08-11 23:53

个回答

  • 慕粉3895972
    2019-08-12 00:49:01
    已采纳

    self表示对当前对象的引用你要赋值的是当前对象的score属性,所以要用self.score