There is too much print and I want some of the temporary prints be erased. For example, I have:
import time
for shard in range(3):
for i in range(100):
print("image_{} in shard_{}".format(i, shard))
time.sleep(1)
Instead of a list of all the prints
image_0 in shard_0
image_1 in shard_0
image_2 in shard_0
image_3 in shard_0
I want to see them printed once and then be replaced by the next print.
image_0 in shard_0
image_1 in shard_0
image_2 in shard_0
At the end I shall only have
image_99 in shard_0
image_99 in shard_1
image_99 in shard_2
on the screen.
How could I achieve that?