mirror of
https://github.com/python/cpython.git
synced 2025-08-18 15:51:23 +00:00
Remove things specific to the old Macintosh, and spell "Mac OS X" consistently.
This commit is contained in:
parent
f2a2c796e3
commit
9af9498c6e
34 changed files with 189 additions and 205 deletions
|
@ -237,15 +237,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.
|
||||
|
||||
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.
|
||||
On Windows, ``'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.
|
||||
|
||||
|
||||
.. _tut-filemethods:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue