1Use hasattr()
2
3hasattr(object, name)
4#The arguments are an object and a string.
5#The result is True if the string is the name of one of the
6#object’s attributes, False if not.
7#(This is implemented by calling getattr(object, name) and
8#seeing whether it raises an AttributeError or not.)
9
10Docs: https://docs.python.org/3/library/functions.html#hasattr