(*exception)
使用上下文管理的方式忽略错误。
    with ignored(OSError):
        print(1)
        raise(OSError)

    print(2)
使用上下文管理的方式忽略错误。
    with ignored(OSError):
        print(1)
        raise(OSError)
使用上下文管理的方式忽略错误。 with ignored ( OSError ) : print ( 1 ) raise ( OSError )
def ignored(*exception):
    """
    使用上下文管理的方式忽略错误。
    with ignored(OSError):
        print(1)
        raise(OSError)

    print(2)

    """
    if exception:
        try:
            yield
        except exception:
            logger.error("error has ignored.", exc_info=True)
    else:
        try:
            yield 
        except:
            logger.error("error has ignored.", exc_info=True)
def ignored ( * exception ) : if exception : try : yield except exception : logger . error ( "error has ignored." , exc_info = True ) else : try : yield except : logger . error ( "error has ignored." , exc_info = True )