[Python-checkins] Correct info about "f.read(size)". (GH13852)
Miss Islington (bot)
webhook-mailer at python.org
Tue Sep 10 12:00:12 EDT 2019
https://github.com/python/cpython/commit/6c588a00ed88dc621023771d5c50167423d0eea3
commit: 6c588a00ed88dc621023771d5c50167423d0eea3
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-09-10T09:00:09-07:00
summary:
Correct info about "f.read(size)". (GH13852)
In text mode, the "size" parameter indicates the number of characters, not bytes.
(cherry picked from commit faff81c05f838b0b7a64bbc8c53c02a9b04bb79d)
Co-authored-by: William Andrea <william.j.andrea at gmail.com>
files:
M Doc/tutorial/inputoutput.rst
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index fc2bd5578c4c..9fe1276ec9d1 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -358,8 +358,8 @@ To read a file's contents, call ``f.read(size)``, which reads some quantity of
data and returns it as a string (in text mode) or bytes object (in binary mode).
*size* is an optional numeric argument. When *size* is omitted or negative, the
entire contents of the file will be read and returned; it's your problem if the
-file is twice as large as your machine's memory. Otherwise, at most *size* bytes
-are read and returned.
+file is twice as large as your machine's memory. Otherwise, at most *size*
+characters (in text mode) or *size* bytes (in binary mode) are read and returned.
If the end of the file has been reached, ``f.read()`` will return an empty
string (``''``). ::
More information about the Python-checkins
mailing list