Answers for "python suppress print output from function"

0

python suppress print output from function

with nostdout():
    foo()
Posted by: Guest on September-24-2021
0

python suppress print output from function

import contextlib
import io
import sys

@contextlib.contextmanager
def nostdout():
    save_stdout = sys.stdout
    sys.stdout = io.BytesIO()
    yield
    sys.stdout = save_stdout
Posted by: Guest on September-24-2021

Code answers related to "python suppress print output from function"

Python Answers by Framework

Browse Popular Code Answers by Language