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
7b6ca4ab
Kaydet (Commit)
7b6ca4ab
authored
Nis 27, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#5061: improve open() docs a bit.
üst
47a7d700
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
functions.rst
Doc/library/functions.rst
+16
-15
No files found.
Doc/library/functions.rst
Dosyayı görüntüle @
7b6ca4ab
...
@@ -676,38 +676,39 @@ are always available. They are listed here in alphabetical order.
...
@@ -676,38 +676,39 @@ are always available. They are listed here in alphabetical order.
*closefd* is set to ``False``.)
*closefd* is set to ``False``.)
*mode* is an optional string that specifies the mode in which the file is
*mode* is an optional string that specifies the mode in which the file is
opened. It defaults to ``'r'`` which means open for reading in text mode.
opened. The available modes are:
Other common values are ``'w'`` for writing (truncating the file if it
already exists), and ``'a'`` for appending (which on *some* Unix systems,
means that *all* writes append to the end of the file regardless of the
current seek position). In text mode, if *encoding* is not specified the
encoding used is platform dependent. (For reading and writing raw bytes use
binary mode and leave *encoding* unspecified.) The available modes are:
========= ===============================================================
========= ===============================================================
Character Meaning
Character Meaning
--------- ---------------------------------------------------------------
--------- ---------------------------------------------------------------
``'r'`` open for reading (default)
``'r'`` open for reading (default)
``'w'`` open for writing, truncating the file first
``'w'`` open for writing, truncating the file first
if it exists
``'a'`` open for writing, appending to the end of the file if it exists
``'a'`` open for writing, appending to the end of the file if it exists
``'b'`` binary mode
========= ===============================================================
Several characters can be appended that modify the given mode:
========= ===============================================================
``'t'`` text mode (default)
``'t'`` text mode (default)
``'+'`` open a disk file for updating (reading and writing)
``'b'`` binary mode
``'+'`` open for updating (reading and writing)
``'U'`` universal newline mode (for backwards compatibility; should
``'U'`` universal newline mode (for backwards compatibility; should
not be used in new code)
not be used in new code)
========= ===============================================================
========= ===============================================================
The default mode is ``'rt'`` (open for reading text). For binary random
The mode ``'w+'`` opens and truncates the file to 0 bytes, while ``'r+'``
access, the mode ``'w+b'`` opens and truncates the file to 0 bytes, while
opens the file without truncation. On *some* Unix systems, append mode means
``'r+b'`` opens the file without truncation.
that *all* writes append to the end of the file regardless of the current
seek position.
Python distinguishes between files opened in binary and text modes, even when
Python distinguishes between files opened in binary and text modes, even when
the underlying operating system doesn't. Files opened in binary mode
the underlying operating system doesn't. Files opened in binary mode
(including ``'b'`` in the *mode* argument) return contents as ``bytes``
(including ``'b'`` in the *mode* argument) return contents as ``bytes``
objects without any decoding. In text mode (the default, or when ``'t'`` is
objects without any decoding. In text mode (the default, or when ``'t'`` is
included in the *mode* argument), the contents of the file are returned as
included in the *mode* argument), the contents of the file are returned as
strings, the bytes having been first decoded using a platform-dependent
strings, the bytes having been first decoded using the specified *encoding*.
encoding or using the specified *encoding* if given.
If *encoding* is not specified, a platform-dependent default encoding is
used, see below.
*buffering* is an optional integer used to set the buffering policy. By
*buffering* is an optional integer used to set the buffering policy. By
default full buffering is on. Pass 0 to switch buffering off (only allowed
default full buffering is on. Pass 0 to switch buffering off (only allowed
...
...
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