首页 > 解决方案 > 在 Jupyter Notebook 中显示多个 HTML 内容(循环中的 IFrame)

问题描述

我正在使用 Jupyther 笔记本,我在 IFrame 中遇到“循环”问题。

下面的代码有效(这意味着 html 内容显示在 jupyter notbook 中)

from IPython.display import IFrame
subfile_name = '2021W17_CQI-KPI_2/'
kpi = "3G DATA VOLUME TB (DT)"
IFrame(src='./'+subfile_name+kpi+'.html', width=980, height=600)

但是,这段代码没有显示 html 内容,我想按顺序查看 html 内容

from IPython.display import IFrame
kpis=["3G DATA VOLUME TB (DT)","LTE DATA VOLUME TB (DT)"]
for i in kpis:
    IFrame(src='./'+subfile_name+i+'.html', width=980, height=600)

如何在 Jupyter notebook 中按顺序查看多个 html 内容?

标签: pythonloopsiframejupyter-notebook

解决方案


推荐阅读