Module StringIO :: Class StringIO
[show private | hide private]
[frames | no frames]

Class StringIO

Known Subclasses:
StringIOWithoutClosing, StringIOWithoutClosing, StringIOWithoutClosing, StringIOWithoutClosing, StringIOWithNoClose

class StringIO([buffer])

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 StringIO object can accept either Unicode or 8-bit strings, but mixing the two may take some care. If both are used, 8-bit strings that cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause a UnicodeError to be raised when getvalue() is called.
Method Summary
  __init__(self, buf)
  __iter__(self)
  close(self)
Free the memory buffer.
  flush(self)
  getvalue(self)
Retrieve the entire contents of the "file" at any time before the StringIO object's close() method is called.
  isatty(self)
  read(self, n)
  readline(self, length)
  readlines(self, sizehint)
  seek(self, pos, mode)
  tell(self)
  truncate(self, size)
  write(self, s)
  writelines(self, list)

Method Details

close(self)

Free the memory buffer.

getvalue(self)

Retrieve the entire contents of the "file" at any time before the StringIO object's close() method is called.

The StringIO object can accept either Unicode or 8-bit strings, but mixing the two may take some care. If both are used, 8-bit strings that cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause a UnicodeError to be raised when getvalue() is called.

Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:25:25 2003 http://epydoc.sf.net