[英]Integer in html output (jupyter notebook)
Simplest way to do it is construct the string: 最简单的方法是构造字符串:
htmlOutput = '<h2>Note: '+ str(i) +'</h2>'
and inject the string in your snippet: 并在您的代码段中注入字符串:
from IPython.core.display import display, HTML
for i in range(10):
htmlOutput = '<h2>Note: '+ str(i) +'</h2>'
display(HTML(htmlOutput))
This should work for you : 这应该适合你:
from IPython.core.display import display,HTML
for i in range(10):
display(HTML('<h2>Note %s</h2> '%i))
The output willl be: 输出将是:
Note 0
Note 1
Note 2
Note 3
Note 4
Note 5
Note 6
Note 7
Note 8
Note 9
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.