summaryrefslogtreecommitdiff
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorWilliam Andrea <william.j.andrea@gmail.com>2019-09-10 10:50:26 -0400
committerBenjamin Peterson <benjamin@python.org>2019-09-10 15:50:26 +0100
commitfaff81c05f838b0b7a64bbc8c53c02a9b04bb79d (patch)
tree9497cb779f8e62b7edc5e596050d269baa9e5b07 /Doc/tutorial
parent05184515f924c3880067aad87940dd466f751585 (diff)
downloadcpython-git-faff81c05f838b0b7a64bbc8c53c02a9b04bb79d.tar.gz
Correct info about "f.read(size)". (GH13852)
In text mode, the "size" parameter indicates the number of characters, not bytes.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/inputoutput.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index fc2bd5578c..9fe1276ec9 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 (``''``). ::