Burton Samograd writes:
> Terry Reedy 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 scre
Terry Reedy 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 cap
On 11/23/2010 3:02 PM, Chris Rebert wrote:
On Tue, Nov 23, 2010 at 11:53 AM, Burton Samograd wrote:
Hello,
I was wondering if there is any way in python to 'collect output to
string' as in some lisps/schemes. Output being, printed output to the
console using print.
Rebind sys.s
On Tue, Nov 23, 2010 at 1:15 PM, Ian wrote:
> On Nov 23, 1:59 pm, Burton Samograd wrote:
>> Thanks for the tip. Here's my function:
>>
>> def with_output_to_string(f, args):
>> oldstdout = sys.stdout
>> buffer = StringIO.StringIO()
>> sys.stdout = buffer
>> apply(f, args)
>>
On Nov 23, 1:59 pm, Burton Samograd wrote:
> Thanks for the tip. Here's my function:
>
> def with_output_to_string(f, args):
> oldstdout = sys.stdout
> buffer = StringIO.StringIO()
> sys.stdout = buffer
> apply(f, args)
> sys.stdout = oldstdout
> return buffer.getval
On 23/11/2010 20:59, Burton Samograd wrote:
Chris Rebert writes:
On Tue, Nov 23, 2010 at 11:53 AM, Burton Samograd wrote:
Hello,
I was wondering if there is any way in python to 'collect output to
string' as in some lisps/schemes. Output being, printed output to the
console u
Chris Rebert writes:
> On Tue, Nov 23, 2010 at 11:53 AM, Burton Samograd wrote:
>> Hello,
>>
>> I was wondering if there is any way in python to 'collect output to
>> string' as in some lisps/schemes. Output being, printed output to the
>> cons
On Tue, Nov 23, 2010 at 11:53 AM, Burton Samograd wrote:
> Hello,
>
> I was wondering if there is any way in python to 'collect output to
> string' as in some lisps/schemes. Output being, printed output to the
> console using print.
Rebind sys.stdout to a StringIO objec
Hello,
I was wondering if there is any way in python to 'collect output to
string' as in some lisps/schemes. Output being, printed output to the
console using print.
Thanks.
--
Burton Samograd
--
http://mail.python.org/mailman/listinfo/python-list