I really like how in the IPython Notebook you can add a class method called _repr_html_()
to print a rich HTML version of your class.
Is there a way to explicitly force this output, say if I want to print 2 objects out at the same time?
print obj1, obj2
Or, if I have a wrapper class for many of these objects and I want to nest their HTML representation inside the wrapper representation?
def _repr_html_(self):
return '<td>%s</td><td></td>' % (self.obj1, self.obj2)
Use from IPython.display import display
and call display
on each or your objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With