¡@

Home 

python Programming Glossary: save_stdout

Silence the stdout of a function in python without trashing sys.stdout and restoring each function call

http://stackoverflow.com/questions/2828953/silence-the-stdout-of-a-function-in-python-without-trashing-sys-stdout-and-resto

Broken Code from sys import stdout from copy import copy save_stdout copy stdout stdout open 'trash' 'w' foo stdout save_stdout Edit.. save_stdout copy stdout stdout open 'trash' 'w' foo stdout save_stdout Edit Corrected code from Alex Martelli import sys save_stdout.. Edit Corrected code from Alex Martelli import sys save_stdout sys.stdout sys.stdout open 'trash' 'w' foo sys.stdout save_stdout..