How can I 'compound' streams?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • XiaQ

    #1

    How can I 'compound' streams?

    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?
  • Dan Bishop

    #2
    Re: How can I 'compound' streams?

    On Jun 27, 7:40 pm, XiaQ <hn_sd_ywx_x... @163.comwrote:
    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(f ile):
    def write(self, data):
    file.write(self , data)
    sys.stdout.writ e(data)

    Comment

    Working...