summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial/inputoutput.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/tutorial/inputoutput.rst')
-rw-r--r--Doc/tutorial/inputoutput.rst19
1 files changed, 9 insertions, 10 deletions
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index d4cad87..acd82d5 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -195,16 +195,15 @@ automatically added to the end. ``'r+'`` opens the file for both reading and
writing. The *mode* argument is optional; ``'r'`` will be assumed if it's
omitted.
-``'b'`` appended to the mode opens the file in binary mode, so there are
-also modes like ``'rb'``, ``'wb'``, and ``'r+b'``. Python distinguishes
-between text and binary files. Binary files are read and written without
-any data transformation. In text mode, platform-specific newline
-representations are automatically converted to newlines when read and
-newline characters are automatically converted to the proper
-platform-specific representation when written. This makes writing portable
-code which reads or writes text files easier. In addition, when reading
-from or writing to text files, the data are automatically decoded or
-encoding, respectively, using the encoding associated with the file.
+On Windows and the Macintosh, ``'b'`` appended to the mode opens the file in
+binary mode, so there are also modes like ``'rb'``, ``'wb'``, and ``'r+b'``.
+Windows makes a distinction between text and binary files; the end-of-line
+characters in text files are automatically altered slightly when data is read or
+written. This behind-the-scenes modification to file data is fine for ASCII
+text files, but it'll 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. On Unix, it doesn't hurt to append a ``'b'`` to the mode, so
+you can use it platform-independently for all binary files.
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