Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
d87fcf43
Kaydet (Commit)
d87fcf43
authored
May 15, 2014
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #21364: remove recommendation of broken pattern.
üst
1e71c534
2d1ec064
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
sys.rst
Doc/library/sys.rst
+12
-15
No files found.
Doc/library/sys.rst
Dosyayı görüntüle @
d87fcf43
...
@@ -1066,8 +1066,9 @@ always available.
...
@@ -1066,8 +1066,9 @@ always available.
statements and for the prompts of :func:`input`;
statements and for the prompts of :func:`input`;
* The interpreter's own prompts and its error messages go to ``stderr``.
* The interpreter's own prompts and its error messages go to ``stderr``.
By default, these streams are regular text streams as returned by the
These streams are regular :term:`text files <text file>` like those
:func:`open` function. Their parameters are chosen as follows:
returned by the :func:`open` function. Their parameters are chosen as
follows:
* The character encoding is platform-dependent. Under Windows, if the stream
* The character encoding is platform-dependent. Under Windows, if the stream
is interactive (that is, if its :meth:`isatty` method returns ``True``), the
is interactive (that is, if its :meth:`isatty` method returns ``True``), the
...
@@ -1075,26 +1076,22 @@ always available.
...
@@ -1075,26 +1076,22 @@ always available.
platforms, the locale encoding is used (see :meth:`locale.getpreferredencoding`).
platforms, the locale encoding is used (see :meth:`locale.getpreferredencoding`).
Under all platforms though, you can override this value by setting the
Under all platforms though, you can override this value by setting the
:envvar:`PYTHONIOENCODING` environment variable.
:envvar:`PYTHONIOENCODING` environment variable
before starting Python
.
* When interactive, standard streams are line-buffered. Otherwise, they
* When interactive, standard streams are line-buffered. Otherwise, they
are block-buffered like regular text files. You can override this
are block-buffered like regular text files. You can override this
value with the :option:`-u` command-line option.
value with the :option:`-u` command-line option.
To write or read binary data from/to the standard streams, use the
.. note::
underlying binary :data:`~io.TextIOBase.buffer`. For example, to write
bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``. Using
:meth:`io.TextIOBase.detach`, streams can be made binary by default. This
function sets :data:`stdin` and :data:`stdout` to binary::
def make_streams_binary():
To write or read binary data from/to the standard streams, use the
sys.stdin = sys.stdin.detach()
underlying binary :data:`~io.TextIOBase.buffer` object. For example, to
sys.stdout = sys.stdout.detach()
write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``.
Note that the streams may be replaced with objects (like :class:`io.StringIO`)
However, if you are writing a library (and do not control in which
that do not support the :attr:`~io.BufferedIOBase.buffer` attribute or the
context its code will be executed), be aware that the standard streams
:meth:`~io.BufferedIOBase.detach` method and can raise :exc:`AttributeError`
may be replaced with file-like objects like :class:`io.StringIO` which
or :exc:`io.UnsupportedOperation`
.
do not support the :attr:`~io.BufferedIOBase.buffer` attribute
.
.. data:: __stdin__
.. data:: __stdin__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment