(exc, /, value=_sentinel)
return list(te.format_exception_only())
Format the exception part of a traceback.

    The return value is a list of strings, each ending in a newline.

    Normally, the list contains a single string; however, for
    SyntaxError exceptions, it contains several lines that (when
    printed) display detailed information about where the syntax
    error occurred.

    The message indicating which exception occurred is always the last
    string in the list.
Format the exception part of a traceback.
Format the exception part of a traceback .
def format_exception_only(exc, /, value=_sentinel):
    """Format the exception part of a traceback.

    The return value is a list of strings, each ending in a newline.

    Normally, the list contains a single string; however, for
    SyntaxError exceptions, it contains several lines that (when
    printed) display detailed information about where the syntax
    error occurred.

    The message indicating which exception occurred is always the last
    string in the list.

    """
    if value is _sentinel:
        value = exc
    te = TracebackException(type(value), value, None, compact=True)
    return list(te.format_exception_only())
def format_exception_only ( exc , / , value = _sentinel ) : if value is _sentinel : value = exc te = TracebackException ( type ( value ) , value , None , compact = True ) return list ( te . format_exception_only ( ) )