Printing w/o newlines inside loops - odd behavior

Erik Max Francis max at alcyone.com
Tue Sep 13 23:59:44 CEST 2005


Jeffrey E. Forcier wrote:

> Doing multiple print statements inside a for loop, using the 'comma at
> the end eats the newline' variant, results in zero output until the
> loop completes its entire iteration.

sys.stdout is line buffered.  Put an intervening sys.stdout.flush() in 
between your prints.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Substance is one of the greatest of our illusions.
   -- Sir Arthur Eddington



More information about the Python-list mailing list