[RELEASED] Python 3.1 final

Christian Heimes lists at cheimes.de
Sun Jun 28 18:09:57 CEST 2009

Paul Moore schrieb:
> 2009/6/28 "Martin v. Löwis" <martin at v.loewis.de>:
>>> However, sys.std{in,out,err} are still created as text streams, and AFAICT
>>> there's nothing you can do about this from within your code.
>> That's intentional, and not going to change. You can access the
>> underlying byte streams if you want to, as you could already in 3.0.
> I had a quick look at the documentation, and couldn't see how to do
> this. It's the first time I'd read the new IO module documentation, so
> I probably missed something obvious. Could you explain how I get the
> byte stream underlying sys.stdin? (That should give me enough to find
> what I was misunderstanding in the docs).

You've missed the most obvious place to look for the feature -- the
documentation of sys.stdin :)


>>> import sys
>>> sys.stdin
<io.TextIOWrapper object at 0x7f65df915050>
>>> sys.stdin.buffer
<io.BufferedReader object at 0x7f65df90bdd0>
>>> sys.stdin.read(1)

>>> sys.stdin.buffer.read(1)



More information about the Python-list mailing list