Home  >  Q&A  >  body text

python - 这种终端任务柱状图怎么写?[图]

用pip安装时候显示的任务柱状图,可以检测任务

PHP中文网PHP中文网2741 days ago178

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:30:05

    • tqdm Refer to the demo on the website.

    • Progress Bar for Console Programs as Iterator If you want to write it yourself, you can refer to this, it is also very good.

    reply
    0
  • 黄舟

    黄舟2017-04-18 09:30:05

    print()其实就可以。用unicode的字符表示进度。然后用"r"Remove the carriage return.

    Just one code is enough:

    import time
    
    i = 1
    while i < 50:
        s = "█" * i
        print("{}\t\t{}".format(s, i), end="\r")
        i += 1
        time.sleep(1)

    reply
    0
  • Cancelreply