Python Programming - Objects - Discussion

Discussion Forum : Objects - General Questions (Q.No. 9)
9.
In Python, what is the purpose of the __str__ method in a class?
To convert the object to a string representation
To create a new instance of the class
To define class attributes
To delete the class object
Answer: Option
Explanation:
The __str__ method is used to define a human-readable string representation of the object when the str() function is called.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.