How can the terminal output of executables run by Python functions be silenced in a general way?
问题 I want to suppress all of the terminal output produced by a function that runs executables. I have attempted to suppress the output of a Python function by using a context manager that temporarily redefines stdout and stderr each time the function is called. This suppresses terminal output produced by print calls in the function, but it doesn\'t seem to work when the function calls executables that produce terminal output. So, how could the output of executables called by Python functions be