File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
257257objects. 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
262263to 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
264265reading and writing such files.
You can’t perform that action at this time.
0 commit comments