summaryrefslogtreecommitdiffstats
path: root/Doc/library/functions.rst
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-10 15:04:56 (GMT)
committerGregory P. Smith <greg@krypto.org>2019-09-10 15:04:56 (GMT)
commit80722308820c112f0e473f2353f550d5aeb90352 (patch)
treed345a6eb9052c34b8a494a52586082a98da13a2c /Doc/library/functions.rst
parent97c2f68a4c0bf4e69a1e769928d7928fab73a666 (diff)
downloadcpython-80722308820c112f0e473f2353f550d5aeb90352.zip
cpython-80722308820c112f0e473f2353f550d5aeb90352.tar.gz
cpython-80722308820c112f0e473f2353f550d5aeb90352.tar.bz2
Note regarding + mode truncation applies to both text and binary mode (GH-11314) (GH-15869)
* Improve doc on open's mode + * Improve wording * Address comment from RĂ©mi (cherry picked from commit c1d8c1cb8e90a54a3daaa7fcdb8d6ca7f08d6a73) Co-authored-by: Andre Delfino <adelfino@gmail.com>
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r--Doc/library/functions.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index c748b08..a4097b0 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1068,12 +1068,12 @@ are always available. They are listed here in alphabetical order.
``'a'`` open for writing, appending to the end of the file if it exists
``'b'`` binary mode
``'t'`` text mode (default)
- ``'+'`` open a disk file for updating (reading and writing)
+ ``'+'`` open for updating (reading and writing)
========= ===============================================================
The default mode is ``'r'`` (open for reading text, synonym of ``'rt'``).
- For binary read-write access, the mode ``'w+b'`` opens and truncates the file
- to 0 bytes. ``'r+b'`` opens the file without truncation.
+ Modes ``'w+'`` and ``'w+b'`` opens and truncates the file. Modes ``'r+'``
+ and ``'r+b'`` opens the file with no truncation.
As mentioned in the :ref:`io-overview`, Python distinguishes between binary
and text I/O. Files opened in binary mode (including ``'b'`` in the *mode*