class Test:
def __init__(self,top,bottom):
self.num = top
self.den = bottom
def __str__(self):
return str(self.num)+"/"+str(self.den)
What is the use of this __str__(self)
?
why do we use __methodname__()
in python? Is there any specific use?