从Python
3.4开始,您可以使用
contextlib.suppress:
from contextlib import suppresswith suppress(Exception): # or, better, a more specific error (or errors) do_magic()with suppress(Exception): do_foo()with suppress(Exception): do_bar()
或者,
fuckit。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)