File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1052,8 +1052,12 @@ Text I/O
1052
1052
1053
1053
The initial value of the buffer can be set by providing *initial_value *.
1054
1054
If newline translation is enabled, newlines will be encoded as if by
1055
- :meth: `~TextIOBase.write `. The stream is positioned at the start of
1056
- the buffer.
1055
+ :meth: `~TextIOBase.write `. The stream is positioned at the start of the
1056
+ buffer which emulates opening an existing file in a `w+ ` mode, making it
1057
+ ready for an immediate write from the beginning or for a write that
1058
+ would overwrite the initial value. To emulate opening a file in an `a+ `
1059
+ mode ready for appending, use `f.seek(0, io.SEEK_END) ` to reposition the
1060
+ stream at the end of the buffer.
1057
1061
1058
1062
The *newline * argument works like that of :class: `TextIOWrapper `,
1059
1063
except that when writing output to the stream, if *newline * is ``None ``,
You can’t perform that action at this time.
0 commit comments