use 'with' to redirect stdout
exarkun at divmod.com
Mon Feb 11 16:03:46 CET 2008
On Mon, 11 Feb 2008 09:38:34 -0500, Neal Becker <ndbecker2 at gmail.com> wrote:
>Jean-Paul Calderone wrote:
>> On Mon, 11 Feb 2008 09:15:07 -0500, Neal Becker <ndbecker2 at gmail.com>
>>>Is there a simple way to use a 'with' statement to redirect stdout in a
>> Do you mean "without writing a context manager to do the redirection"?
>I mean, whatever is the simplest solution. I don't know much about the
>subject of context manager at this point.
Something like http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/534166
will probably do what you want.
More information about the Python-list