1.

What is getattr() used for?(a) To access the attribute of the object(b) To delete an attribute(c) To check if an attribute exists or not(d) To set an attributeI got this question in semester exam.The above asked question is from Classes and Objects in chapter Classes and Objects, Inheritance, Polymorphism, Encapsulation and Exception Handling of Python

Answer»

The correct CHOICE is (a) To access the ATTRIBUTE of the OBJECT

Easy explanation - getattr(OBJ,name) is used to GET the attribute of an object.



Discussion

No Comment Found

Related InterviewSolutions