diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-12-07 14:58:03 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-12-07 14:58:03 (GMT) |
commit | eb9fc524a8a0fa9d60e1bc5b74174b18e08fd008 (patch) | |
tree | 1d88aca5cfd2ac524f9ab2ea9d06af768cdce331 | |
parent | 2ed237bd221500cef36376ba658b589d444599c0 (diff) | |
download | cpython-eb9fc524a8a0fa9d60e1bc5b74174b18e08fd008.zip cpython-eb9fc524a8a0fa9d60e1bc5b74174b18e08fd008.tar.gz cpython-eb9fc524a8a0fa9d60e1bc5b74174b18e08fd008.tar.bz2 |
document how to deal with binary standard streams
-rw-r--r-- | Doc/library/sys.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index e4dbf17..e87b7e1 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -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__ |