printing bytes to stdout in Py3

Casey Caseyweb at gmail.com
Tue Feb 17 13:15:09 EST 2009


On Feb 17, 12:33 pm, Christian Heimes <li... at cheimes.de> wrote:
> Yes, it's really the official way. You can google up the discussion
> between me and Guido on the python-dev list if you don't trust me. ;)
> The docs concur with me, too.
>
> http://docs.python.org/3.0/library/sys.html#sys.stdin
>
> Note: The standard streams are in text mode by default. To write or read
> binary data to these, use the underlying binary buffer. For example, to
> write bytes to stdout, use sys.stdout.buffer.write(b'abc').

Thanks! Incidentally, the 'Note:' section you reference in the HTML
docs doesn't appear to be in the .CHM file that installs with the
windows version of 3.01.  That would have made my search a lot
easier :-%



More information about the Python-list mailing list