diff options
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r-- | Doc/library/io.rst | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst index 85e8c5b..82969eb 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -471,10 +471,13 @@ Raw File I/O * an integer representing the number of an existing OS-level file descriptor to which the resulting :class:`FileIO` object will give access. - The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing, - or appending. The file will be created if it doesn't exist when opened for - writing or appending; it will be truncated when opened for writing. Add a - ``'+'`` to the mode to allow simultaneous reading and writing. + The *mode* can be ``'r'``, ``'w'``, ``'x'`` or ``'a'`` for reading + (default), writing, creating or appending. The file will be created if it + doesn't exist when opened for writing or appending; it will be truncated + when opened for writing. :exc:`FileExistsError` will be raised if it already + exists when opened for creating. Opening a file for creating implies + writing, so this mode behaves in a similar way to ``'w'``. Add a ``'+'`` to + the mode to allow simultaneous reading and writing. The :meth:`read` (when called with a positive argument), :meth:`readinto` and :meth:`write` methods on this class will only make one system call. @@ -487,6 +490,7 @@ Raw File I/O .. versionchanged:: 3.3 The *opener* parameter was added. + The ``'x'`` mode was added. In addition to the attributes and methods from :class:`IOBase` and :class:`RawIOBase`, :class:`FileIO` provides the following data |