Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How can I 'compound' streams?

Reply
Thread Tools

How can I 'compound' streams?

 
 
XiaQ
Guest
Posts: n/a
 
      06-28-2007
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?
 
Reply With Quote
 
 
 
 
Dan Bishop
Guest
Posts: n/a
 
      06-28-2007
On Jun 27, 7:40 pm, XiaQ <(E-Mail Removed)> 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)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Can Groovy be used in an applet and/or can it generate the Java bytecodes that then can be used in an applet? Casey Hawthorne Java 1 03-18-2009 12:56 AM
Word Docs Won't Open, Can't Be E-Mailed, Can't Be Deleted, Can't Be Copied, Etc. Martin Computer Support 16 02-24-2009 07:35 PM
Wireless can get internet but can't see network -- can when wired 02befree Computer Support 0 12-24-2007 09:10 PM
SOLVED - can't open file in windows media player / WMP. But can in VLC - video LAN .. Now can in WMP jameshanley39@yahoo.co.uk Computer Information 2 09-19-2007 02:53 AM



Advertisments