I have several cycles together and sleep in the innermost cycle. eg:
from time import sleep for i in range(10): print i, for j in range(-5,5): if j > 0: print '.', else: print 'D', sleep(1) print ''
if you run the code, you can expect i get after D sleep 1 second and another D and again sleeping until the end.
but the result will be different, it waits 10 seconds and prints the whole line 0 DDDDDD . . . . 0 DDDDDD . . . . and again waiting to print the next line.
I found that the comma at the end of the print is causing this problem. How can I solve it?
Farhadix
source share