How can I 'compound' streams?

Discussion in 'Python' started by XiaQ, Jun 28, 2007.

  1. XiaQ

    XiaQ Guest

    I need to build a stream that writes to stdout and a file at the same
    time. Is there already a function in the Python library to do this?
    XiaQ, Jun 28, 2007
    #1
    1. Advertising

  2. XiaQ

    Dan Bishop Guest

    On Jun 27, 7:40 pm, XiaQ <> wrote:
    > I need to build a stream that writes to stdout and a file at the same
    > time. Is there already a function in the Python library to do this?



    class FileAndStdout(file):
    def write(self, data):
    file.write(self, data)
    sys.stdout.write(data)
    Dan Bishop, Jun 28, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWlrZUw=?=
    Replies:
    0
    Views:
    381
    =?Utf-8?B?TWlrZUw=?=
    Nov 19, 2004
  2. Damir Mikoc

    CMR/CMP and Compound Primary Key

    Damir Mikoc, Jul 3, 2003, in forum: Java
    Replies:
    1
    Views:
    553
    Christopher Blunck
    Jul 4, 2003
  3. Apc
    Replies:
    1
    Views:
    838
  4. Greg N.
    Replies:
    20
    Views:
    1,007
    Greg N.
    Feb 15, 2006
  5. kath
    Replies:
    0
    Views:
    501
Loading...

Share This Page