diff options
| author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-10-18 03:29:07 (GMT) |
|---|---|---|
| committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-10-18 03:29:07 (GMT) |
| commit | 56d279fe35e7d3df988761c8407359399574356c (patch) | |
| tree | 9e68d874a4524cea85507f34d2450c0bc0f279cc /Doc/tutorial | |
| parent | f17512f67e545bfeda1905b63f80217e0b7853aa (diff) | |
| parent | 206f962f32cb537efa115387f3337b28c58006bb (diff) | |
| download | cpython-56d279fe35e7d3df988761c8407359399574356c.zip cpython-56d279fe35e7d3df988761c8407359399574356c.tar.gz cpython-56d279fe35e7d3df988761c8407359399574356c.tar.bz2 | |
Merge from 3.3: clarify universal-newline wording in tutorial (issue #16266).
This also null merges from a previous commit.
Diffstat (limited to 'Doc/tutorial')
| -rw-r--r-- | Doc/tutorial/inputoutput.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst index 73143be..1324359 100644 --- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -256,9 +256,10 @@ default being UTF-8). ``'b'`` appended to the mode opens the file in :dfn:`binary mode`: now the data is read and written in the form of bytes objects. This mode should be used for all files that don't contain text. -In text mode, the default is to convert platform-specific line endings (``\n`` -on Unix, ``\r\n`` on Windows) to just ``\n`` on reading and ``\n`` back to -platform-specific line endings on writing. This behind-the-scenes modification +In text mode, the default when reading is to convert platform-specific line +endings (``\n`` on Unix, ``\r\n`` on Windows) to just ``\n``. When writing in +text mode, the default is to convert occurrences of ``\n`` back to +platform-specific line endings. This behind-the-scenes modification to file data is fine for text files, but will corrupt binary data like that in :file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when reading and writing such files. |
