MCQs > IT & Programming > Python > Correct way to call the private method, myPrivateMethod(), in class MyClass, using dir(obj)? class MyClass: def __myPrivateMethod(self): print dir(obj)

Python MCQs

Which of the following is the correct way to call the private method, myPrivateMethod(), in class MyClass, using dir(obj)?

class MyClass:

    def __myPrivateMethod(self):

        print "Private Method"

obj = MyClass()

print dir(obj)

Answer

Correct Answer: _MyClass__myPrivateMethod

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Python Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it