document how to deal with binary standard streams

This commit is contained in:
Benjamin Peterson 2008-12-07 14:58:03 +00:00
parent 2ed237bd22
commit eb9fc524a8
1 changed files with 6 additions and 0 deletions

View File

@ -709,6 +709,12 @@ always available.
:func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in
the :mod:`os` module.)
.. note::
The standard streams are text in text mode by default. To write or read
binary data to these, use the underlying binary buffer. For example, to
write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``.
.. data:: __stdin__
__stdout__