import os, sys, time for x in xrange(0,5): print x sys.stdout.flush() time.sleep(2)