2020
10-16
10-16
Python使用内置函数setattr设置对象的属性值
英文文档:setattr(object,name,value)Thisisthecounterpartofgetattr().Theargumentsareanobject,astringandanarbitraryvalue.Thestringmaynameanexistingattributeoranewattribute.Thefunctionassignsthevaluetotheattribute,providedtheobjectallowsit.Forexample,setattr(x,'foobar',123)isequivalenttox.foobar=123设置对象的属性值说明:1.setattr函数和geta...
继续阅读 >