Collect output to string
Burton Samograd
burton at userful.com
Wed Nov 24 13:25:52 EST 2010
Terry Reedy <tjreedy at udel.edu> writes:
> On 11/23/2010 3:02 PM, Chris Rebert wrote:
> If you are using print or print(), you can redirect output to the
> StringIO object with >>sfile or file=sfile. I use the latter in a
> custom test function where I normally want output to the screen but
> occasionally want to capture test reports.
Thanks for the info, but I was looking for a way to collect output
without modifying the original function, similar to
with-output-to-string in some schemes.
--
Burton Samograd
More information about the Python-list
mailing list