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. Advertisements

  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. Advertisements

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. Damir Mikoc

    CMR/CMP and Compound Primary Key

    Damir Mikoc, Jul 3, 2003, in forum: Java
    Replies:
    1
    Views:
    678
    Christopher Blunck
    Jul 4, 2003
  2. Apc
    Replies:
    1
    Views:
    1,022
  3. Greg N.
    Replies:
    20
    Views:
    1,250
    Greg N.
    Feb 15, 2006
  4. Vasileios Zografos

    compound assignment operator

    Vasileios Zografos, Jul 15, 2003, in forum: C++
    Replies:
    4
    Views:
    394
    Thomas Matthews
    Jul 15, 2003
  5. Sonia

    what is a compound class

    Sonia, Apr 19, 2004, in forum: C++
    Replies:
    4
    Views:
    640
    David Harmon
    Apr 20, 2004
  6. Greg
    Replies:
    3
    Views:
    757
  7. Mantorok Redgormor

    compound literals

    Mantorok Redgormor, Sep 14, 2003, in forum: C Programming
    Replies:
    3
    Views:
    601
    Mantorok Redgormor
    Sep 16, 2003
  8. kath
    Replies:
    0
    Views:
    902
Loading...