[IPython-User] ipython Notebook html issue

Krishna Kumar krishnakumar85@gmail....
Wed Apr 11 15:55:13 CDT 2012


Hi,

I have been working on ipython for around a week and it is very nice. I
have installed the ipython 0.13b (dev). The new notebook interface is very
cool and impressive. I tried this out:

[code]
from IPython.core.display import HTML

class A(HTML):
    def __init__(self):
        self.wrong = 3
        self.correct = 5

    def calc(self):
        self.wrong += 2
        self.correct -= 1

    def _repr_html_(self):
        return "<i>wrong</i><b>%i</b><i>correct</i><b>%i</b>"%(self.wrong,
self.correct)

A()
[/code]

When the code is executed, the output is not html, it displays as
"wrong3correct5"* *(But when the same is pasted in this email, it displays
properly...* **wrong**3**correct**5*, which indicates that the browser is
not rendering the italics and the bold properly).

When I tried with:
[code]
return
"<table><tr><td>wrong</td><td>%i</td></tr><tr><td>correct</td><td>%i</td></tr></table></b>"%(self.wrong,
self.correct)
[/code]
It shows:
Out[4]: (in table)
wrong3correct5

What could be the issue?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120412/3b3b9cd1/attachment.html 


More information about the IPython-User mailing list