Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bf7f1f

Browse files
committed
Clarify universal-newline wording in tutorial (issue #16266).
1 parent 0dccbe1 commit 5bf7f1f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Doc/tutorial/inputoutput.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,10 @@ default being UTF-8). ``'b'`` appended to the mode opens the file in
256256
:dfn:`binary mode`: now the data is read and written in the form of bytes
257257
objects. This mode should be used for all files that don't contain text.
258258

259-
In text mode, the default is to convert platform-specific line endings (``\n``
260-
on Unix, ``\r\n`` on Windows) to just ``\n`` on reading and ``\n`` back to
261-
platform-specific line endings on writing. This behind-the-scenes modification
259+
In text mode, the default when reading is to convert platform-specific line
260+
endings (``\n`` on Unix, ``\r\n`` on Windows) to just ``\n``. When writing in
261+
text mode, the default is to convert occurrences of ``\n`` back to
262+
platform-specific line endings. This behind-the-scenes modification
262263
to file data is fine for text files, but will corrupt binary data like that in
263264
:file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when
264265
reading and writing such files.

0 commit comments

Comments
 (0)