How can I 'compound' streams?

Dan Bishop danb_83 at yahoo.com
Thu Jun 28 03:20:47 CEST 2007


On Jun 27, 7:40 pm, XiaQ <hn_sd_ywx_x... at 163.com> 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)




More information about the Python-list mailing list