console output delay

Peter Hansen peter at engcorp.com
Thu Oct 16 10:06:33 EDT 2003


Dominik Kaspar wrote:
> 
> hello, my question concerns the following code fragment:
> 
> print "searching for bla bla...",
> [long calculation]
> print "found", numberofblablas
> 
> when this program is running, the "please be patient message" is not
> displayed until the long calculation has actually completed.
> is there any way to force the first print statement to be shown on the
> console?

sys.stdout.flush() ?

Alternatively you may find "python -u" to be of help.  Using "python -h"
to learn more.

-Peter




More information about the Python-list mailing list