我尝试了许多不同的方法,但是没有一个起作用。
这是我的代码:
def countdown(word, time):
import time as wait
import sys
inloop = 0
time = int(time)
texttimer = time
while True:
print (word, 'in', texttimer)
wait.sleep(1)
sys.stdout.write("\033[F")
sys.stdout.write("\033[K")
inloop = inloop + 1
texttimer = texttimer - 1
if inloop == time:
break
countdown("Respawning", 5)