python實現最簡單的進度條

python實現最簡單的進度條

import sys,time
total = 100
for i in range(total):
    a = "#" * i + " " * (100-i) + "["+str(i) + "%"+"]"
    sys.stdout.write("\r%s" %a)
    sys.stdout.flush()
    time.sleep(0.1)


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章