Printing on the same line with time.sleep()

The issue is that , by default, the console output is buffered.
Since Python 3.3 print() supports the keyword argument flush (see documentation):

print('hello', flush=True)

If you use an prior versionf of python, you can force a flush like this:

import sys
sys.stdout.flush()

Leave a Comment