Mine
public text v1 · immutableimport sys
real_out = sys.stdout
class MyOutput:
def write(self, text):
text = text.strip()
if not text: return
# send to web server
real_out.write(text)
sys.stdout = MyOutput()
print "hello world"