blob: 1241e185f7c3c7236bd139d2d9bea05f8aa9414b [file] [log] [blame]
Guido van Rossumcda3d7d1997-03-03 16:01:21 +00001\section{Standard Module \sectcode{StringIO}}
Guido van Rossum53209981997-07-17 16:29:04 +00002\label{module-StringIO}
Guido van Rossumcda3d7d1997-03-03 16:01:21 +00003
4\stmodindex{StringIO}
5
6This module implements a file-like class, \code{StringIO},
Fred Drake387c5751997-04-02 14:51:56 +00007that reads and writes a string buffer (also known as {\em memory
Guido van Rossumcda3d7d1997-03-03 16:01:21 +00008files}). See the description on file objects for operations.
9
10When a \code{StringIO} object is created, it can be initialized
11to an existing string by passing the string to the constructor.
12If no string is given, the \code{StringIO} will start empty.
13
Guido van Rossum53209981997-07-17 16:29:04 +000014The method \code{getvalue()} can be called to retrieve the entire
15contents of the ``file'' at any time before the \code{StringIO}
16object's \code{close()} method is called. Calling \code{close()} will
17free the memory buffer.