📅  最后修改于: 2022-03-11 14:45:34.735000             🧑  作者: Mango
import contextlib
import io
import sys
@contextlib.contextmanager
def nostdout():
save_stdout = sys.stdout
sys.stdout = io.BytesIO()
yield
sys.stdout = save_stdout