Printing Objects
In this lesson, you'll learn how to print objects in Python.
We'll cover the following...
Introduction to __str__
method
The print
method takes any number of arguments, converts each argument into a string by calling its __str__
method, and prints them. As with __init__
, that’s two underscores before
and after the name.
All classes have a __str__
method inherited from object
. It is a good idea to override ...