.. note::
- Underlying encoded files are always opened in binary mode.
+ If *encoding* is not ``None``, then the
+ underlying encoded files are always opened in binary mode.
No automatic conversion of ``'\n'`` is done on reading and writing.
The *mode* argument may be any binary mode acceptable to the built-in
:func:`open` function; the ``'b'`` is automatically added.
codecs. Output is also codec dependent and will usually be
Unicode as well.
- Underlying encoded files are always opened in binary mode.
+ If encoding is not None, then the
+ underlying encoded files are always opened in binary mode.
The default file mode is 'r', meaning to open the file in read mode.
encoding specifies the encoding which is to be used for the
"spamspam", self.spambe)
def test_bug691291(self):
- # Files are always opened in binary mode, even if no binary mode was
+ # If encoding is not None, then
+ # files are always opened in binary mode, even if no binary mode was
# specified. This means that no automatic conversion of '\n' is done
# on reading and writing.
s1 = 'Hello\r\nworld\r\n'