Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GH-95880: Clarify StringIO append/overwrite behavior #96104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Doc/library/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,12 @@ Text I/O

The initial value of the buffer can be set by providing *initial_value*.
If newline translation is enabled, newlines will be encoded as if by
:meth:`~TextIOBase.write`. The stream is positioned at the start of
the buffer.
:meth:`~TextIOBase.write`. The stream is positioned at the start of the
buffer which emulates opening an existing file in a `w+` mode, making it
ready for an immediate write from the beginning or for a write that
would overwrite the initial value. To emulate opening a file in an `a+`
mode ready for appending, use `f.seek(0, io.SEEK_END)` to reposition the
stream at the end of the buffer.

The *newline* argument works like that of :class:`TextIOWrapper`,
except that when writing output to the stream, if *newline* is ``None``,
Expand Down