禁止打印调用(python)
标签:val type span open def __enter__ python 打印 null
原文 : https://cloud.tencent.com/developer/ask/188486
import os, sys class HiddenPrints: def __enter__(self): self._original_stdout = sys.stdout sys.stdout = open(os.devnull, ‘w‘) def __exit__(self, exc_type, exc_val, exc_tb): sys.stdout.close() sys.stdout = self._original_stdout
禁止打印调用(python)
标签:val type span open def __enter__ python 打印 null
温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/file/biancheng/11976.html