xiaoxue85 发表于 2015-4-25 08:33:35

python中hassttr()

  判断一个对象是否含有某种属性。
  >>> 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.)
页: [1]
查看完整版本: python中hassttr()