Peter Hoffmann on Stackoverflow @peterhoffmann on twitter Peter Hoffmann on Facebook Contact me per email Subscribe to Atom Feed

Peter Hoffmann

Software Engineer
prev page next page

Python file interface for strings

Posted on October 27, 2008
#stackoverflow #python

This my Answer to the stackoverflow question: Python file interface for strings:

Yes, there is StringIO:

import StringIO
import sys

sys.stdout = StringIO.StringIO()
print "foo", "bar", "baz"
s = sys.stdout.getvalue()