Iterating over standard in blocks until EOF is read Iterating over standard in blocks until EOF is read unix unix

Iterating over standard in blocks until EOF is read


According to the python -h help message:

-u Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters, also put stdin, stdout and stderr in binary mode. Note that there is internal buffering in xread‐ lines(), readlines() and file-object iterators ("for line in sys.stdin") which is not influenced by this option. To work around this, you will want to use "sys.stdin.readline()" inside a "while 1:" loop.