Python: Printing in the same exact spot using \r not working? -
I am trying to print the same place:
for the category I (10): Print ("OK \"), However, it prints 10 OKs in different lines:
OK ... I tried to put \ r in front of the string in this case, I get a blank line, then 10 oaks:
[Empty] ok ok ... I also tried the following
import System (s) for class (10): sys.stdout.write ('ok \ r') sys.stdout.flush () But the exact thing I found was in Python 2 I'm on Python, what am I doing wrong? I also tried it in idle, and the result of 'okokokokokokok' occurs when \ r occurs in the end, and 'okay okay okay okay okay okay okay okay' the result is coming out.
Edit: I'm on Windows 7
Any help is highly appreciated!
Try the following code, it works on Ubuntu, I've included a time. So call so that you can see what's actually going on:
Import time to limit (10): print (str (I), end = '\ r') time.sleep (.4)
Comments
Post a Comment