发布时间:2019-09-21 10:47:08编辑:auto阅读(3301)
说明:判断对象object是否包含名为name的特性(hasattr是通过调用getattr(ojbect, name)是否抛出异常来实现的)。
参数object:对象。
参数name:特性名称。
返回为True或者为False def getattribute(self, name):
try:
r=object.__getattribute__(self, name)
except:
r=None
return r
上一篇: python3.x 快速入门
下一篇: python获得当前模块路径
51039
50433
41033
37899
32368
29261
28141
22982
22945
21273
1151°
1856°
1515°
1441°
1727°
1531°
2191°
3783°
3694°
2604°