[Tutor] un-buffered web output

ian douglas ian.douglas at iandouglas.com
Fri Mar 25 20:46:08 CET 2011

Hey List,

In Perl, I can manipulate a special variable called $| to control 
buffered output, even on web pages, so I can watch something run (like 
CGI processes reading files or running system commands) as Perl 
processes it (pseudo real-time), as opposed to languages like PHP which 
buffers all output and draws it all in one shot.

I saw this on Stack Overflow, and was curious if this is still the best 
practice to do the same thing in Python?

sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)


More information about the Tutor mailing list