python打印进度条倒计时

import time
i = 10
'''
注意下面print语句中的加号换成逗号,在pycharm中无法打印不包含 ’\r‘ 的字符串,i为倒计时的秒数
到0秒会停止
'''
while i >= 0:
        print("\rtt"+" (=^_^=)  " * i +  f'请您{i}秒后重新输入',end = '')
        i -= 1
        time.sleep(1)

 

转载自:https://blog.csdn.net/qq_35515661/article/details/81173378

You may also like...