1997-03-03 12:01:21 -04:00
|
|
|
\section{Standard Module \sectcode{StringIO}}
|
1997-07-17 13:29:04 -03:00
|
|
|
\label{module-StringIO}
|
1997-03-03 12:01:21 -04:00
|
|
|
|
|
|
|
\stmodindex{StringIO}
|
|
|
|
|
|
|
|
This module implements a file-like class, \code{StringIO},
|
1998-01-14 10:51:31 -04:00
|
|
|
that reads and writes a string buffer (also known as \emph{memory
|
1997-03-03 12:01:21 -04:00
|
|
|
files}). See the description on file objects for operations.
|
|
|
|
|
|
|
|
When a \code{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 \code{StringIO} will start empty.
|
|
|
|
|
1997-07-17 13:29:04 -03:00
|
|
|
The method \code{getvalue()} can be called to retrieve the entire
|
|
|
|
contents of the ``file'' at any time before the \code{StringIO}
|
|
|
|
object's \code{close()} method is called. Calling \code{close()} will
|
|
|
|
free the memory buffer.
|