Flush

François Pinard pinard at iro.umontreal.ca
Mon Jul 8 15:36:06 EDT 2002


[Charles]

> Anyone know if python has a flush() function like PHP, to buffer dump
> in CGI ?

All file objects have a `.flush()' method.  Like PHP, I do not know! :-)

It is usually convenient doing:

   sys.stdout.flush()

right after outputting the HTTP header, if you are going to do some lenghty
computation, and want to convince the user browser to wait after your script.
Without this, the browser might decide that your server is not responding...

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list