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

Skip to content

Commit 3261fa5

Browse files
committed
detach() is a nifty trick for making std* binary
1 parent ff85bca commit 3261fa5

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

Doc/library/sys.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -781,11 +781,10 @@ always available.
781781
:func:`os.popen`, :func:`os.system` or the :func:`exec\*` family of functions in
782782
the :mod:`os` module.)
783783

784-
.. note::
785-
786-
The standard streams are in text mode by default. To write or read binary
787-
data to these, use the underlying binary buffer. For example, to write
788-
bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``.
784+
The standard streams are in text mode by default. To write or read binary
785+
data to these, use the underlying binary buffer. For example, to write bytes
786+
to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``. Using
787+
:meth:`io.TextIOWrapper.detach` streams can be made binary by default.
789788

790789

791790
.. data:: __stdin__

0 commit comments

Comments
 (0)