hasattr

python hasattr():判断一个对象是否含有某种属性

>>> help(hasattr)
Help on built-in function hasattr in module __builtin__:

hasattr(...)
    hasattr(object, name) -> bool
   
    Return whether the object has an attribute with the given name.
    (This is done by calling getattr(object, name) and catching exceptions.)

>>>

posted on 2013-06-21 10:55  语辰  阅读(368)  评论(0编辑  收藏  举报