python check if attribute exits code example
Example 1: python check if has attribute
if hasattr(a, 'property'):
a.property
Example 2: python check if attribute exists in class
if hasattr(obj, 'propertyName'):
...
if hasattr(a, 'property'):
a.property
if hasattr(obj, 'propertyName'):
...