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

Skip to content

Commit 2932d93

Browse files
committed
#3007: remove stringio docs and fix a few nits in io docs.
1 parent eec0d5f commit 2932d93

3 files changed

Lines changed: 20 additions & 121 deletions

File tree

Doc/library/io.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,9 @@ Text I/O
630630

631631
.. class:: StringIO([initial_value[, encoding[, errors[, newline]]]])
632632

633-
An in-memory stream for text. It in inherits :class:`TextIOWrapper`.
633+
An in-memory stream for text. It inherits :class:`TextIOWrapper`.
634634

635-
Create a new StringIO stream with an inital value, encoding, error handling,
635+
Create a new StringIO stream with an initial value, encoding, error handling,
636636
and newline setting. See :class:`TextIOWrapper`\'s constructor for more
637637
information.
638638

@@ -641,8 +641,25 @@ Text I/O
641641

642642
.. method:: getvalue()
643643

644-
Return a ``str`` containing the entire contents of the buffer.
644+
Return a ``str`` containing the entire contents of the buffer at any
645+
time before the :class:`StringIO` object's :meth:`close` method is
646+
called.
645647

648+
Example usage::
649+
650+
import io
651+
652+
output = io.StringIO()
653+
output.write('First line.\n')
654+
print('Second line.', file=output)
655+
656+
# Retrieve file contents -- this will be
657+
# 'First line.\nSecond line.\n'
658+
contents = output.getvalue()
659+
660+
# Close object and discard memory buffer --
661+
# .getvalue() will now raise an exception.
662+
output.close()
646663

647664
.. class:: IncrementalNewlineDecoder
648665

Doc/library/stringio.rst

Lines changed: 0 additions & 117 deletions
This file was deleted.

Doc/library/strings.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ string functions based on regular expressions.
2121
re.rst
2222
struct.rst
2323
difflib.rst
24-
stringio.rst
2524
textwrap.rst
2625
codecs.rst
2726
unicodedata.rst

0 commit comments

Comments
 (0)