Python to print out status bar and percentage

后端 未结 20 1017
野的像风
野的像风 2020-11-28 01:01

To implement a status bar like below:

[==========                ]  45%
[================          ]  60%
[==========================] 100%

20条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 01:04

    For Python 3.6 the following works for me to update the output inline:

    for current_epoch in range(10):
        for current_step) in range(100):
            print("Train epoch %s: Step %s" % (current_epoch, current_step), end="\r")
    print()
    

提交回复
热议问题