I was trying to create a progress-like thing by printing a dot every second on the same line. Something like "Fishing.....". This is what I used:
import time
print('Fishing', end='')
for i in range(5):
time.sleep(1)
print('.', end='')
But it waits for 5 seconds and prints Fishing.....
all at once. But when I don't use the end=''
, it prints dots every second, but on separate lines like so
Fishing.
.
.
.
.
My questions:
- Why does
print
behave this way? - How can I print a dot every second, but on the same line?