Search found 1 match

by lumengna
Sat Feb 16, 2019 1:12 am
Forum: tsase
Topic: printf quiet mode
Replies: 3
Views: 13951

Re: printf quiet mode

An easier way to do this is to create a wrapper function like this (sorry I don't know how to turn on code format): class SuppressPrint: def __enter__(self): self._original_stdout = sys.stdout sys.stdout = None def __exit__(self, exc_type, exc_val, exc_tb): sys.stdout = self._original_stdout You can...