as clause

The part of an except clause, as name, that gives you the exception object so you can read its message.

In more detail

except ValueError as err: lets you print err or log it. The name is removed when the handler ends. The same word as appears in import ... as and with ... as, where it also binds a name.

Related terms

Taught in

References