2020
10-16
10-16
Python通过getattr函数获取对象的属性值
英文文档:getattr(object,name[,default])Returnthevalueofthenamedattributeofobject.namemustbeastring.Ifthestringisthenameofoneoftheobject'sattributes,theresultisthevalueofthatattribute.Forexample,getattr(x,'foobar')isequivalenttox.foobar.Ifthenamedattributedoesnotexist,defaultisreturnedifprovided,otherwiseAttributeErrorisraised.获取对象...
继续阅读 >