class People(object):
pass
def score(self,attr):
self.attr=attr
People.score=score
if __name__ == '__main__':
p=People()
p.score("11")
print(p.attr)
方式二:
class People(object):
pass
def score(self,attr):
self.attr=attr
People.score=score
if __name__ == '__main__':
p=People()
p.score("11")
print(p.attr)
方式二: