Exception Attributes
UnicodeError.start — exception attribute
Read the start index of the failing region. It is a zero-based index into the object: byte offsets for decoding, code-point indices for encoding or translation. Manually constructed exceptions can carry unusual bounds, so validate externally supplied metadata before relying on it.
Formal Syntax & Structure
python syntaxpython
error.startReturn 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.start)