I've just started learning python from the source learnjavathehardway
.
There was a "fun" code that goes as follows
while True:
for i in ["/","-","|","\\","|"]:
print "%s\r" % i,
Now what it does is that at the same place in my console, it prints the different character one by one. (Try it yourself if you did not get what I said)
Basically,it prints / - | \ |
in quick succession, at the same place.
If I remove comma from the end of print statement, it prints each character in a new line.
Now I want to know, why is it printing out at the same place? And not one after the other? Thanks