How can i repaint the output in one cell


I want to only repaint one line output, not print all line. How can i do it ?

This is a Python question and not a Jupyter question.
(Hint: Maybe initialize a list and store the values there and then when the loop is done, print the list?)

Agreed that this is a python question. Look at the documentation for print(): https://docs.python.org/3.8/library/functions.html#print

Notice that by default, the end argument is a newline, meaning put a newline after each print call. So just use print(i*i, end=' ') or something similar.

1 Like

I mean, redraw the output, the next output directly overwrites the current output, not appending, but overwrite . I want to implement a dynamic progress bar scenario

print(i*i, end='\r') may work

1 Like

I works , thanks for reply gratefully [quote=“jasongrout, post:5, topic:6000, full:true”]
print(i*i, end='\r') may work
[/quote]