美文网首页
2018-12-02 文本进度条

2018-12-02 文本进度条

作者: 子小亦大 | 来源:发表于2018-12-02 09:57 被阅读0次

文本进度条

#TextProBar.py

import time

scale = 50

t1 = time.perf_counter()

print("start the process".center(scale//2,"-"))

for i in range(scale + 1):

    a = "*"*i

    b = "."*(scale - i)

    c = 100*i/scale

    t2 = time.perf_counter() - t1

    print("\r{0:^3.1f}%[{1}->{2}]{3:.3f}s".format(c,a,b,t2),end="")

    time.sleep(0.1)

print()

print("{:-^25}".format("end the process"))

相关文章

网友评论

      本文标题:2018-12-02 文本进度条

      本文链接:https://www.haomeiwen.com/subject/awtjcqtx.html