Monday, June 06, 2011

Python: How to print a class or objects of class using print()? - Stack Overflow

Python: How to print a class or objects of class using print()? - Stack Overflow: "class Test:
def __init__(self, a, b):
self.a = a
self.b = b

def __repr__(self):
return '' % (self.a, self.b)

def __str__(self):
return 'From str method of Test: a is %s, b is %s' % (self.a, self.b)"