Printing w/o newlines inside loops - odd behavior

Erik Max Francis max at alcyone.com
Tue Sep 13 17:59:44 EDT 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