Python hasattr() – Easy Examples and Use Cases
Python’s built-in hasattr(object, string) function takes an object and a string as an input. It returns True if one of the object‘s attributes has the name given by the string. Otherwise, it returns False. Syntax hasattr() The hasattr() object has the following syntax: Syntax: hasattr(object, attribute) # Does the object have this attribute? Arguments object … Read more