So I know from
Redirecting stdout to "nothing" in python
that you can suppress print statements. But is it possible to undo that command later on, so that after a certain points, print statements will indeed be printed again?
For example, let's say I want to print "b" but not "a".
I would do:
import os
f = open(os.devnull, 'w')
sys.stdout = f
print("a")
# SOME COMMAND
print("b")
Could someone enlighten me as to what "SOME COMMAND" would be?