print problem

Chris cwitts at
Tue Jun 17 10:17:30 CEST 2008

On Jun 17, 8:15 am, pirata <pir... at mars.invalid> wrote:
> I was trying to print a dot on console every second to indicates
> running process, so I wrote, for example:
> for i in xrange(10):
>     print ".",
>     time.sleep(1)
> Idealy, a dot will be printed out each second. But there is nothing
> print out until after 10 seconds, all 10 dots come out together.
> I've tried lose the comma in the print statement, and it works.
> Is that because of the print statement buffer the characters until
> there is a new line character?
> Thanks

import sys
for i in xrange(10):

More information about the Python-list mailing list