perl to python
Josh Gilbert
usr at bin.com
Sun May 16 05:34:24 EDT 2004
It's in the python man page:
-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.
When I use sys.stdin.readline I don't need to use to -u flag.
You can also use raw_input() to get data from stdin. This also appears to
strip out the newline.
Josh Gilbert.
Andrew Dalke wrote:
> Scott Schwartz
>> No effect, because that's not the problem.
>
> Ahh, you're right. I keyword matched "buffer" and thought you meant
> the system buffer and not Python's.
>
> Andrew
> dalke at dalkescientific.com
More information about the Python-list
mailing list