On Unix, I can either use \r (carriage return) or \b (backspace) to print over text already visible in the shell (i.e. overwrite the current line again).
Can I achieve the same effect in a Windows command line from a Python script?
I tried the curses module but it doesn't seem to be available on Windows.
Thanks for all the useful answers in here guys. I needed this :)
I found nosklo's answer particularly useful, but I wanted something fully contained within a function by passing the desired output as a parameter. Also, I didn't really need the timer, since I wanted the printing to take place after a specific event).
This is what did the trick for me, I hope someone else finds it useful:
On Windows (python 3), it seems to work (not using stdout directly):
The same line is updated everytime print function is called.
This algorithm can be improved, but it is posted to show what you can do. You can modify the method according to your needs.
Easiest way is to use two \r - one at the beginning and one at the end
It will go pretty quickly