Routing sys.stdout.write (print)
betz at bmi.net.bbs
betz at bmi.net.bbs
Mon Jul 17 19:00:03 EDT 2000
I'm getting unexpected results from the following code:
import sys
from sys import stdout
x = stdout
class Writer
def write(self, string):
x.write(': ' + string)
sys.stdout = Writer()
print "Ni!"
x.write('Ni!\n')
The output I'm getting is:
: Ni!:
Ni!
I am looking for a solution so that the second colon isn't in the
output. A good solution
may be very different then the code I have here.
Thanks,
Joseph Betz
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
More information about the Python-list
mailing list