Copy Stdout to string

sophie_newbie paulgeeleher at gmail.com
Tue Apr 1 11:13:26 EDT 2008


On Apr 1, 3:03 pm, sophie_newbie <paulgeele... at gmail.com> wrote:
> Hi, I'm wondering if its possible to copy all of stdout's output to a
> string, while still being able to print on screen. I know you can
> capture stdout, but I still need the output to appear on the screen
> also...
>
> Thanks!

I found this, it pretty much does the job, easily modified to write to
a variable instead of a file:

http://www.answermysearches.com/python-how-to-print-to-screen-and-a-file-at-the-same-time/52/



More information about the Python-list mailing list