Skip to content

Commit 075a441

Browse files
Correct info about "f.read(size)". (GH13852)
In text mode, the "size" parameter indicates the number of characters, not bytes. (cherry picked from commit faff81c) Co-authored-by: William Andrea <[email protected]>
1 parent 494b61a commit 075a441

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/tutorial/inputoutput.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ To read a file's contents, call ``f.read(size)``, which reads some quantity of
356356
data and returns it as a string (in text mode) or bytes object (in binary mode).
357357
*size* is an optional numeric argument. When *size* is omitted or negative, the
358358
entire contents of the file will be read and returned; it's your problem if the
359-
file is twice as large as your machine's memory. Otherwise, at most *size* bytes
360-
are read and returned.
359+
file is twice as large as your machine's memory. Otherwise, at most *size*
360+
characters (in text mode) or *size* bytes (in binary mode) are read and returned.
361361
If the end of the file has been reached, ``f.read()`` will return an empty
362362
string (``''``). ::
363363

0 commit comments

Comments
 (0)