I'm calling a simple little method that prints an initial statement and then a period every second. It's printing each new dot on a new line, however, and I want them all on one line, like this: 'Checking. . . . . .'
When I follow the print statements with a comma, or if I use sys.stdout.write()
, the method hangs until the entire loop is complete, and then prints all at once.
Here's my code. Using python 2.4.3 - don't have a choice about that, I'm afraid.
class WaitTimer(object):
def timer(self, time, countDown=0):
if countDown == 0:
print "\nChecking.",
if countDown <= time:
countDown += 1
print ".",
self.timer(time, countDown)
wait = WaitTimer()
wait.timer(5)