Print in one line dynamically

后端 未结 20 3595
梦谈多话
梦谈多话 2020-11-21 23:32

I would like to make several statements that give standard output without seeing newlines in between statements.

Specifically, suppose I have:

for it         


        
20条回答
  •  轮回少年
    2020-11-21 23:42

    Or even simpler:

    import time
    a = 0
    while True:
        print (a, end="\r")
        a += 1
        time.sleep(0.1)
    

    end="\r" will overwrite from the beginning [0:] of the first print.

提交回复
热议问题