如Person对象有属性:name,age
则在其他类中,可以使用
p = Person('忧里修斯','男')
则在其他类中,可以使用
sex = getattr(p, 'name')获取其值
p = Person('忧里修斯','男')
sex = getattr(p, 'name')获取其值