# 4.6 Standard Module `StringIO`

This module implements a file-like class, `StringIO`, that reads and writes a string buffer (also known as memory files). See the description on file objects for operations.

When a `StringIO` object is created, it can be initialized to an existing string by passing the string to the constructor. If no string is given, the `StringIO` will start empty.

The method `getvalue()` can be called to retrieve the entire contents of the ``file'' at any time before the `StringIO` object's `close()` method is called. Calling `close()` will free the memory buffer.