diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-02-11 21:54:51 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-02-11 21:54:51 (GMT) |
commit | d1a107132cf8a500478885fef282a1f945b9a981 (patch) | |
tree | c2d5e4d655484f17788f7c0a94acdf1d545e1e02 /Doc/library/gzip.rst | |
parent | f4bdf4e478adc3f7c0ec54e60bb3359f51058722 (diff) | |
parent | 30d94b7aea69440605cc7d65e06ac374c25c74c1 (diff) | |
download | cpython-d1a107132cf8a500478885fef282a1f945b9a981.zip cpython-d1a107132cf8a500478885fef282a1f945b9a981.tar.gz cpython-d1a107132cf8a500478885fef282a1f945b9a981.tar.bz2 |
Merge: #13989: Document that GzipFile does not support text mode.
Diffstat (limited to 'Doc/library/gzip.rst')
-rw-r--r-- | Doc/library/gzip.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 82c9522..9e57990 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -44,9 +44,11 @@ The module defines the following items: The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, ``'w'``, or ``'wb'``, depending on whether the file will be read or written. The default - is the mode of *fileobj* if discernible; otherwise, the default is ``'rb'``. If - not given, the 'b' flag will be added to the mode to ensure the file is opened - in binary mode for cross-platform portability. + is the mode of *fileobj* if discernible; otherwise, the default is ``'rb'``. + + Note that the file is always opened in binary mode; text mode is not + supported. If you need to read a compressed file in text mode, wrap your + :class:`GzipFile` with an :class:`io.TextIOWrapper`. The *compresslevel* argument is an integer from ``1`` to ``9`` controlling the level of compression; ``1`` is fastest and produces the least compression, and |