mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
Merge from 3.2: clarify universal-newline wording in tutorial (issue #16266).
This commit is contained in:
commit
206f962f32
1 changed files with 4 additions and 3 deletions
|
|
@ -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
|
: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.
|
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``
|
In text mode, the default when reading is to convert platform-specific line
|
||||||
on Unix, ``\r\n`` on Windows) to just ``\n`` on reading and ``\n`` back to
|
endings (``\n`` on Unix, ``\r\n`` on Windows) to just ``\n``. When writing in
|
||||||
platform-specific line endings on writing. This behind-the-scenes modification
|
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
|
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
|
:file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when
|
||||||
reading and writing such files.
|
reading and writing such files.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue