471,337 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

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?
Jun 28 '07 #1
1 1037
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(file):
def write(self, data):
file.write(self, data)
sys.stdout.write(data)

Jun 28 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Sonia | last post: by
6 posts views Thread by David W. Fenton | last post: by
6 posts views Thread by William Ahern | last post: by
7 posts views Thread by Eric Laberge | last post: by
1 post views Thread by Chris | last post: by
27 posts views Thread by Nate Eldredge | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.