hasattr(object, name)

查看object有没name属性

有返回True 没有返回 False

原文地址:https://www.cnblogs.com/whigym/p/9920504.html