check if an object has a certain attribute python code example
Example 1: python hasattribute
hasattr(object, name)
Example 2: python3 check if object has attribute
try:
doStuff(a.property)
except AttributeError:
otherStuff()
hasattr(object, name)
try:
doStuff(a.property)
except AttributeError:
otherStuff()