Python 进度条

2021-01-19 23:14

阅读:432

标签:sleep   roc   rate   form   import   ESS   imp   python   range   

# Author:Winter Liu is coming!
import time


def process_bar(num, total):
    rate_num = int(num*100/total)
    if rate_num == 100:
        r = "\r{}{}%\n".format("*"*rate_num, rate_num)  # \r回到行首,百分百就换行
    else:
        r = "\r{}{}%".format("*" * rate_num, rate_num)
    print(r, end="")


for i in range(1,21):
    time.sleep(0.2)
    process_bar(1000*i, 20000)

 

Python 进度条

标签:sleep   roc   rate   form   import   ESS   imp   python   range   

原文地址:https://www.cnblogs.com/nmucomputer/p/12905911.html


评论


亲,登录后才可以留言!