Reading from sys.stdin reads the whole file in

Marko Rauhamaa marko at pacujo.net
Wed Aug 27 01:29:20 EDT 2014


Steven D'Aprano <steve at pearwood.info>:

> When I pipe one to the other, I expect each line to be printed as they
> arrive, but instead they all queue up and happen at once:

Try flushing after each print.

When sys.stdout is a pipe, flushing happens only when the internal
buffer fills up.


Marko



More information about the Python-list mailing list