The __str__ Method
Premium
When you print a list, Python shows its contents neatly. When you print your own object, you get something like <__main__.Dog object>. The __str__ method lets you control what appears.
When you print a list, Python shows its contents neatly. When you print your own object, you get something like <__main__.Dog object>. The __str__ method lets you control what appears.