Let's assume I have a part of code that runs for some specific amount of time and each 1 second outputs something like this: iteration X, score Y
. I will substitute this function with my black box function:
from random import uniform
import time
def black_box():
i = 1
while True:
print 'Iteration', i, 'Score:', uniform(0, 1)
time.sleep(1)
i += 1
Now when I run it in Jupyter notebook, it output a new line after each second:
Iteration 1 Score: 0.664167449844
Iteration 2 Score: 0.514757592404
...
Yes, after when the output becomes too big, the html becomes scrollable, but the thing is that I do not need any of these lines except of currently the last one. So instead of having n
lines after n
seconds, I want to have only 1
line (the last one) shown.
I have not found anything like this in documentation or looking through magic. A question with almost the same title but irrelevant.