cpython: b5439bca219f (original) (raw)

Mercurial > cpython

changeset 79810:b5439bca219f 3.3

Merge from 3.2: clarify universal-newline wording in tutorial (issue #16266). [#16266]

Chris Jerdonek chris.jerdonek@gmail.com
date Wed, 17 Oct 2012 20:21:05 -0700
parents 8a37a8adc87a(current diff)7b2a13b20b33(diff)
children a45cb181e4d0 8ce04be1321c
files
diffstat 1 files changed, 4 insertions(+), 3 deletions(-)[+] [-] Doc/tutorial/inputoutput.rst 7

line wrap: on

line diff

--- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -256,9 +256,10 @@ default being UTF-8). 'b' appended :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.