I am newbie on Python.
I run the following code on python 2.7 and I see different result when I use print or print(). What is the difference between these two functions? I read other questions e.g., this question, but I didn't find my answer.
class Rectangle:
def __init__(self, w, h):
self.width = w
self.height = h
def __str__(self):
return "(The width is: {0}, and the height is: {1})".format(self.width, self.height)
box = Rectangle(100, 200)
print ("box: ", box)
print "box: ", box
The result is:
('box: ', <__main__.Rectangle instance at 0x0293BDC8>)
box: (The width is: 100, and the height is: 200)