python脚本显示运行进程

import time

def exit_time(time_s = 10):
    for time_i in range(time_s, -1, -1):
        process = "倒计时退出: %s  %s " % (time_i,time_s)
        print(process, end='', flush=True)
        time.sleep(1)

# exit_time(time_s = 5)
 


## # #demo2
#for i in range(0, 101, 2):
#    time.sleep(0.1)
#    num = i // 2
#    if i == 100:
#        process = "
[%3s%%]: |%-50s|
" % (i, '*' * num)
#    else:
#        process = "
[%3s%%]: |%-50s|" % (i, '*' * num)
#    print(process, end='', flush=True)
#    
##[100%]: |**************************************************|
 
原文地址:https://www.cnblogs.com/andylhc/p/14646950.html