@@ -73,15 +73,16 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
7373
7474 .. method :: read([size])
7575
76- Read at most *size * uncompressed bytes, returned as a string. If the
76+ Read at most *size * uncompressed bytes, returned as a byte string. If the
7777 *size * argument is negative or omitted, read until EOF is reached.
7878
7979
8080 .. method :: readline([size])
8181
82- Return the next line from the file, as a string, retaining newline. A
83- non-negative *size * argument limits the maximum number of bytes to return
84- (an incomplete line may be returned then). Return an empty string at EOF.
82+ Return the next line from the file, as a byte string, retaining newline.
83+ A non-negative *size * argument limits the maximum number of bytes to
84+ return (an incomplete line may be returned then). Return an empty byte
85+ string at EOF.
8586
8687
8788 .. method :: readlines([size])
@@ -111,15 +112,16 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
111112
112113 .. method :: write(data)
113114
114- Write string *data * to file. Note that due to buffering, :meth: `close ` may
115- be needed before the file on disk reflects the data written.
115+ Write the byte string *data * to file. Note that due to buffering,
116+ :meth: `close ` may be needed before the file on disk reflects the data
117+ written.
116118
117119
118- .. method :: writelines(sequence_of_strings )
120+ .. method :: writelines(sequence_of_byte_strings )
119121
120- Write the sequence of strings to the file. Note that newlines are not
121- added. The sequence can be any iterable object producing strings. This is
122- equivalent to calling write() for each string.
122+ Write the sequence of byte strings to the file. Note that newlines are not
123+ added. The sequence can be any iterable object producing byte strings.
124+ This is equivalent to calling write() for each byte string.
123125
124126
125127Sequential (de)compression
0 commit comments