Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb9fc52

Browse files
committed
document how to deal with binary standard streams
1 parent 2ed237b commit eb9fc52

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Doc/library/sys.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,12 @@ always available.
709709
:func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in
710710
the :mod:`os` module.)
711711

712+
.. note::
713+
714+
The standard streams are text in text mode by default. To write or read
715+
binary data to these, use the underlying binary buffer. For example, to
716+
write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``.
717+
712718

713719
.. data:: __stdin__
714720
__stdout__

0 commit comments

Comments
 (0)