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
3c399d1a
Kaydet (Commit)
3c399d1a
authored
Nis 22, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Various io doc updates
üst
7a3d8641
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
68 deletions
+63
-68
io.rst
Doc/library/io.rst
+63
-68
No files found.
Doc/library/io.rst
Dosyayı görüntüle @
3c399d1a
...
@@ -223,7 +223,7 @@ I/O Base Classes
...
@@ -223,7 +223,7 @@ I/O Base Classes
.. method:: fileno()
.. method:: fileno()
Return the underlying file descriptor (an integer) of the stream
,
if it
Return the underlying file descriptor (an integer) of the stream if it
exists. An :exc:`IOError` is raised if the IO object does not use a file
exists. An :exc:`IOError` is raised if the IO object does not use a file
descriptor.
descriptor.
...
@@ -234,18 +234,18 @@ I/O Base Classes
...
@@ -234,18 +234,18 @@ I/O Base Classes
.. method:: isatty()
.. method:: isatty()
Return
s
``True`` if the stream is interactive (i.e., connected to
Return ``True`` if the stream is interactive (i.e., connected to
a terminal/tty device).
a terminal/tty device).
.. method:: readable()
.. method:: readable()
Return
s ``True`` if the stream can be read from. If False,
Return
``True`` if the stream can be read from. If False, :meth:`read`
:meth:`read`
will raise :exc:`IOError`.
will raise :exc:`IOError`.
.. method:: readline([limit])
.. method:: readline([limit])
Read
s and returns one line from the stream. If *limit* is
Read
and return one line from the stream. If *limit* is specified, at
specified, at
most *limit* bytes will be read.
most *limit* bytes will be read.
The line terminator is always ``b'\n'`` for binary files; for text files,
The line terminator is always ``b'\n'`` for binary files; for text files,
the *newlines* argument to :func:`open` can be used to select the line
the *newlines* argument to :func:`open` can be used to select the line
...
@@ -253,9 +253,9 @@ I/O Base Classes
...
@@ -253,9 +253,9 @@ I/O Base Classes
.. method:: readlines([hint])
.. method:: readlines([hint])
Re
turns a list of lines from the stream. *hint* can be specified to
Re
ad and return a list of lines from the stream. *hint* can be specified
control the number of lines read: no more lines will be read if the total
to control the number of lines read: no more lines will be read if the
size (in bytes/characters) of all lines so far exceeds *hint*.
total
size (in bytes/characters) of all lines so far exceeds *hint*.
.. method:: seek(offset[, whence])
.. method:: seek(offset[, whence])
...
@@ -267,33 +267,32 @@ I/O Base Classes
...
@@ -267,33 +267,32 @@ I/O Base Classes
* ``1`` -- current stream position; *offset* may be negative
* ``1`` -- current stream position; *offset* may be negative
* ``2`` -- end of the stream; *offset* is usually negative
* ``2`` -- end of the stream; *offset* is usually negative
Return
s
the new absolute position.
Return the new absolute position.
.. method:: seekable()
.. method:: seekable()
Returns ``True`` if the stream supports random access. If
Return ``True`` if the stream supports random access. If ``False``,
``False``, :meth:`seek`, :meth:`tell` and :meth:`truncate` will
:meth:`seek`, :meth:`tell` and :meth:`truncate` will raise :exc:`IOError`.
raise :exc:`IOError`.
.. method:: tell()
.. method:: tell()
Return
s
the current stream position.
Return the current stream position.
.. method:: truncate([size])
.. method:: truncate([size])
Truncate
s
the file to at most *size* bytes. *size* defaults to the current
Truncate the file to at most *size* bytes. *size* defaults to the current
file position, as returned by :meth:`tell`.
file position, as returned by :meth:`tell`.
.. method:: writable()
.. method:: writable()
Return
s
``True`` if the stream supports writing. If ``False``,
Return ``True`` if the stream supports writing. If ``False``,
:meth:`write` and :meth:`truncate` will raise :exc:`IOError`.
:meth:`write` and :meth:`truncate` will raise :exc:`IOError`.
.. method:: writelines(lines)
.. method:: writelines(lines)
Write
s a list of lines to the stream. Line separators are no
t
Write
a list of lines to the stream. Line separators are not added, so i
t
added, so it is usual for each of the lines provided to have a
is usual for each of the lines provided to have a line separator at the
line separator at the
end.
end.
.. class:: RawIOBase
.. class:: RawIOBase
...
@@ -306,27 +305,26 @@ I/O Base Classes
...
@@ -306,27 +305,26 @@ I/O Base Classes
.. method:: read([n])
.. method:: read([n])
Read
s and returns
all the bytes from the stream until EOF, or if *n* is
Read
and return
all the bytes from the stream until EOF, or if *n* is
specified, up to *n* bytes.
An empty bytes object is returned on EOF;
specified, up to *n* bytes.
Only one system call is ever made. An empty
``None`` is returned if the object is set not to block and has no data to
bytes object is returned on EOF; ``None`` is returned if the object is set
read.
not to block and has no data to
read.
.. method:: readall()
.. method:: readall()
Read
s and returns all the bytes from the stream until EOF, using
Read
and return all the bytes from the stream until EOF, using multiple
multiple
calls to the stream if necessary.
calls to the stream if necessary.
.. method:: readinto(b)
.. method:: readinto(b)
Read
s up to len(b) bytes into bytearray *b* and returns the number
Read
up to len(b) bytes into bytearray *b* and return the number of bytes
of bytes
read.
read.
.. method:: write(b)
.. method:: write(b)
Writes the given bytes or bytearray object, *b*, to the underlying
Write the given bytes or bytearray object, *b*, to the underlying raw
raw stream and returns the number of bytes written (never less
stream and return the number of bytes written (This is never less than
than ``len(b)``, since if the write fails an :exc:`IOError` will
``len(b)``, since if the write fails, an :exc:`IOError` will be raised).
be raised).
Raw File I/O
Raw File I/O
...
@@ -353,22 +351,21 @@ Raw File I/O
...
@@ -353,22 +351,21 @@ Raw File I/O
.. attribute:: name
.. attribute:: name
The file name.
The file name. This is the file descriptor of the file when no name is
given in the constructor.
.. method:: read([n])
.. method:: read([n])
Reads and returns at most *n* bytes. Only one system call is made, so
Read and return at most *n* bytes. Only one system call is made, so it is
it is possible that less data than was requested is returned. Call
possible that less data than was requested is returned. Use :func:`len`
:func:`len` on the returned bytes object to see how many bytes
on the returned bytes object to see how many bytes were actually returned.
were actually returned (In non-blocking mode, ``None`` is returned
(In non-blocking mode, ``None`` is returned when no data is available.)
when no data is available.)
.. method:: readall()
.. method:: readall()
Reads and returns the entire file's contents in a single bytes
Read and return the entire file's contents in a single bytes object. As
object. As much as immediately available is returned in
much as immediately available is returned in non-blocking mode. If the
non-blocking mode. If the EOF has been reached, ``b''`` is
EOF has been reached, ``b''`` is returned.
returned.
.. method:: write(b)
.. method:: write(b)
...
@@ -406,7 +403,7 @@ Buffered Streams
...
@@ -406,7 +403,7 @@ Buffered Streams
.. method:: read([n])
.. method:: read([n])
Read
s and returns
up to *n* bytes. If the argument is omitted, ``None``, or
Read
and return
up to *n* bytes. If the argument is omitted, ``None``, or
negative, data is read and returned until EOF is reached. An empty bytes
negative, data is read and returned until EOF is reached. An empty bytes
object is returned if the stream is already at EOF.
object is returned if the stream is already at EOF.
...
@@ -421,7 +418,7 @@ Buffered Streams
...
@@ -421,7 +418,7 @@ Buffered Streams
.. method:: readinto(b)
.. method:: readinto(b)
Read
s up to len(b) bytes into bytearray *b* and returns
the number of bytes
Read
up to len(b) bytes into bytearray *b* and return
the number of bytes
read.
read.
Like :meth:`read`, multiple reads may be issued to the underlying raw
Like :meth:`read`, multiple reads may be issued to the underlying raw
...
@@ -432,10 +429,9 @@ Buffered Streams
...
@@ -432,10 +429,9 @@ Buffered Streams
.. method:: write(b)
.. method:: write(b)
Writes the given bytes or bytearray object, *b*, to the underlying
Write the given bytes or bytearray object, *b*, to the underlying raw
raw stream and returns the number of bytes written (never less than
stream and return the number of bytes written (never less than ``len(b)``,
``len(b)``, since if the write fails an :exc:`IOError` will
since if the write fails an :exc:`IOError` will be raised).
be raised).
A :exc:`BlockingIOError` is raised if the buffer is full, and the
A :exc:`BlockingIOError` is raised if the buffer is full, and the
underlying raw stream cannot accept more data at the moment.
underlying raw stream cannot accept more data at the moment.
...
@@ -453,8 +449,7 @@ Buffered Streams
...
@@ -453,8 +449,7 @@ Buffered Streams
.. method:: getvalue()
.. method:: getvalue()
Returns a bytes object containing the entire contents of the
Return ``bytes`` containing the entire contents of the buffer.
buffer.
.. method:: read1()
.. method:: read1()
...
@@ -462,8 +457,8 @@ Buffered Streams
...
@@ -462,8 +457,8 @@ Buffered Streams
.. method:: truncate([size])
.. method:: truncate([size])
Truncate
s the buffer to at most *size* bytes. *size* defaults to the current
Truncate
the buffer to at most *size* bytes. *size* defaults to the
stream position, as returned by :meth:`tell`.
current
stream position, as returned by :meth:`tell`.
.. class:: BufferedReader(raw[, buffer_size])
.. class:: BufferedReader(raw[, buffer_size])
...
@@ -480,20 +475,20 @@ Buffered Streams
...
@@ -480,20 +475,20 @@ Buffered Streams
.. method:: peek([n])
.. method:: peek([n])
Return
s 1 (or *n* if specified) bytes from a buffer without
Return
1 (or *n* if specified) bytes from a buffer without advancing the
advancing the position. Only a single read on the raw stream is done to
position. Only a single read on the raw stream is done to satisfy the
satisfy the call. The number of bytes returned may be less than
call. The number of bytes returned may be less than requested since at
requested since at most all the buffer's bytes from the current
most all the buffer's bytes from the current position to the end are
position to the end are
returned.
returned.
.. method:: read([n])
.. method:: read([n])
Read
s and returns
*n* bytes, or if *n* is not given or negative, until EOF
Read
and return
*n* bytes, or if *n* is not given or negative, until EOF
or if the read call would block in non-blocking mode.
or if the read call would block in non-blocking mode.
.. method:: read1(n)
.. method:: read1(n)
Read
s and returns
up to *n* bytes with only one call on the raw stream. If
Read
and return
up to *n* bytes with only one call on the raw stream. If
at least one byte is buffered, only buffered bytes are returned.
at least one byte is buffered, only buffered bytes are returned.
Otherwise, one raw stream read call is made.
Otherwise, one raw stream read call is made.
...
@@ -518,9 +513,9 @@ Buffered Streams
...
@@ -518,9 +513,9 @@ Buffered Streams
.. method:: write(b)
.. method:: write(b)
Write
s the bytes or bytearray object, *b*, onto the raw stream and
Write
the bytes or bytearray object, *b*, onto the raw stream and return
returns the number of bytes written. A :exc:`BlockingIOError` is
the number of bytes written. A :exc:`BlockingIOError` is raised when the
ra
ised when the ra
w stream blocks.
raw stream blocks.
.. class:: BufferedRWPair(reader, writer[, buffer_size[, max_buffer_size]])
.. class:: BufferedRWPair(reader, writer[, buffer_size[, max_buffer_size]])
...
@@ -577,18 +572,18 @@ Text I/O
...
@@ -577,18 +572,18 @@ Text I/O
.. method:: read(n)
.. method:: read(n)
Read
s and returns at most *n* characters from the stream as a
Read
and return at most *n* characters from the stream as a single
single
:class:`str`. If *n* is negative or ``None``, reads to EOF.
:class:`str`. If *n* is negative or ``None``, reads to EOF.
.. method:: readline()
.. method:: readline()
Read
s until newline or EOF and returns a single :class:`str`. If
Read
until newline or EOF and return a single ``str``. If the stream is
the stream is
already at EOF, an empty string is returned.
already at EOF, an empty string is returned.
.. method:: write(s)
.. method:: write(s)
Write
s the string *s* to the stream and returns the number of
Write
the string *s* to the stream and return the number of characters
characters
written.
written.
.. class:: TextIOWrapper(buffer[, encoding[, errors[, newline[, line_buffering]]]])
.. class:: TextIOWrapper(buffer[, encoding[, errors[, newline[, line_buffering]]]])
...
@@ -647,7 +642,7 @@ Text I/O
...
@@ -647,7 +642,7 @@ Text I/O
.. method:: getvalue()
.. method:: getvalue()
Return
s a :class:`str
` containing the entire contents of the buffer.
Return
a ``str`
` containing the entire contents of the buffer.
.. class:: IncrementalNewlineDecoder
.. class:: IncrementalNewlineDecoder
...
...
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