x = eval(repr(sys.stdout)) ?

Mr. Neutron nicktsocanos at charter.net
Wed Aug 21 12:58:45 EDT 2002

> What am I really trying to do here?  Well I want to redirect sys.stdout
> to be something else and the reset it back later.
I don't really get what you are trying to do but if it helps
stdout is just a file object. You can set stdout to a new file object
and later set it back again. Example: mysocket = socket(...)
sys.stdout = mysocket.makefile('w',...) and then you have stdout
redirected to a socket.

> So the question is:  Is there a way to save a "pointer" to a variable in
There aren't any pointers in Python that I know of...

More information about the Python-list mailing list