When I write a script that updates a printed line, for example like this:
for i in range(101):
print(str(i) + "% \r", end="")
and run this script using the terminal (Ubuntu), I get the correct output, that updated the line:
100%
However, using Pydev in Eclipse, the Eclipse console does this:
0%
1%
2%
...
100%
Anyone know how to fix this? Thanks in advance!
This seems to be the old CR LF problem. Depending on the OS and the console you are using, CR and LF as a line termination will be interpreted differently.
Some systems require a CRLF as an end of line.
Some systems only require LF but do the CR implicitly.
Some systems (like yours) do a LF before each CR implicitly, although this is the first time I see this.
Maybe there is a way to edit the newline settings for your PyDev console.
EDIT: Or you might use ANSI escape codes for moving the cursor around. Like CSInD for n characters to the left or CSInC for n characters to the right.