Exception Attributes

UnicodeError.end — exception attribute

Read the exclusive end index of a codec error span. Together with start, it identifies the failing segment by ordinary slicing. The indices describe the object rather than a terminal display column. A bare UnicodeError lacks this field.

Formal Syntax & Structure

python syntaxpython
error.end

Return Value

int

Metadata on the concrete Unicode exception, when applicable.

Working Example

Example Snippetpython
try:    b"A\xffB".decode("utf-8")except UnicodeDecodeError as error:    print(error.end)
Python Reference