On 7/16/2014 3:49 AM, Steven D'Aprano wrote:

There are certainly use-cases for stdin and stdout to use bytes, but
there are also use-cases for them to deal with strings. I'll certainly
grant you that there ought to be an easy way to get access to the binary
streams,

As has been discussed before on this list, there is in 3.x.
https://docs.python.org/3/library/sys.html#sys.stdin

>>> b=sys.stdin.buffer.readline()
a line
>>> b
b'a line\r\n'

In other words, 3.x text mode (which essentially nothing to do with 2.x 'text' mode), is a wrapped binary mode that gives users the *choice* to read bytes or text.

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to