類測試(對象):
def __setattr__(self,name,value):
自我。__字典_ _[名稱] =值
def __getattr__(self,name):
回歸自我。__詞典_ _[姓名]
if __name__ == "__main__ ":
t =測試()
t.name = "呵呵"
t.__setattr__("年齡",100)
打印t
打印t.name
打印t.age
打印t.__dict__
打印對象。__詞典_ _