How can I 'compound' streams?

X

XiaQ

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?
 
D

Dan Bishop

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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top