📜  python 控制台动画 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:42.336000             🧑  作者: Mango

代码示例1
import time
# bar is the var that loops
bar = [
    " [=     ]",
    " [ =    ]",
    " [  =   ]",
    " [   =  ]",
    " [    = ]",
    " [     =]",
    " [    = ]",
    " [   =  ]",
    " [  =   ]",
    " [ =    ]",
]
i = 0

while thing_isnt_completed: # change loop if necessary
    print(bar[i % len(bar)], end="\r")
    time.sleep(.2) # time per frame
    i += 1