最初的回答:
from IPython.core.display import display,HTML
for i in range(10):
display(HTML('<h2>Note %s</h2> '%i))
Note 0
Note 1
Note 2
Note 3
Note 4
Note 5
Note 6
Note 7
Note 8
Note 9
Simplest way to do it is construct the string:
htmlOutput = '<h2>Note: '+ str(i) +'</h2>'
并在您的代码片段中插入该字符串:
。最初的回答。from IPython.core.display import display, HTML
for i in range(10):
htmlOutput = '<h2>Note: '+ str(i) +'</h2>'
display(HTML(htmlOutput))