io - how to reattach sys.stdout to console window in python? -


my python 3 doodling went this:

import io, sys sys.stdout = io.stringio() # no more responses python terminal funnily enough 

my question how reattach when pass in 1+1 example it'll return 2 console?

this in python interpreter on 32-bit python running on windows 7 64 bit.

you're looking sys.__stdout__:

it can used restore actual files known working file objects in case have been overwritten broken object. however, preferred way explicitly save previous stream before replacing it, , restore saved object.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -