Carriage Return not working in IDLE?

前端 未结 2 896
情深已故
情深已故 2020-12-10 15:12

I\'m trying to create a code for a countdown timer that stays in place: so that each line overwrites the previous one. This is what I have so far:

import tim         


        
2条回答
  •  忘掉有多难
    2020-12-10 15:34

    When \r doesn't work, try \x08 (backspace), and add the flush=True to be safe:

    print('\x08' * 5 + timeformat, end='', flush=True)
    

提交回复
热议问题