overriding "print"?

Alex Martelli alex at magenta.com
Thu Aug 3 17:50:26 EDT 2000


"Jesus Cea Avion" <jcea at argo.es> wrote in message
news:3989CE69.F51DDE68 at argo.es...
> Can "print" be overriden?
>
> I want to do a dual console/Tkinter application, redirecting "print"
> output to a TK window. I can't rewrite the "print" commands because the
> original application (console only) is not under my control.

print will write to sys.stdout.  Just assign whatever object of
yours (implementing a write method) to sys.stdout, and voila -- the
'overriding' you desire.


Alex






More information about the Python-list mailing list