【问题标题】:progress bar update in the same line of a jupyter notebookjupyter notebook 同一行中的进度条更新
【发布时间】:2018-11-17 00:22:22
【问题描述】:

我喜欢 tqdm progress bar 的简单性。然而,我注意到在某些情况下,进度条的每次更新都会打印在 jupyter notebook 的新行中,如下图所示:

如何确保 tqdm 进度条的更新打印在 jupyter notebook 的同一行中,如下图所示:

?

【问题讨论】:

    标签: python jupyter-notebook tqdm


    【解决方案1】:

    tqdm 有一个特定的模块用于处理 jupyter notebook 中的输出,tqdm_notebook:

    import time
    from tqdm import tqdm_notebook as tqdm
    
    for i in tqdm(range(10)):
       time.sleep(1)
    

    【讨论】:

      猜你喜欢
      • 2018-06-12
      • 2017-07-01
      • 2019-10-23
      • 2017-11-26
      • 2018-03-29
      • 2020-09-16
      • 2014-07-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多