🔵 🔵 🔵


Primary

၊၊||၊|။

try ⚬ᵖʸ|Documentation|1st|20260107011717-00-⌔

8. Compound statements — Python 3.14.2 documentation#the-try-statement

8.4. The try statement

The try statement specifies exception handlers and/or cleanup code for a group of statements:

try_stmt:  try1_stmt | try2_stmt | try3_stmt
try1_stmt: "try" ":" suite
          ("except" [expression ["as" identifier]] ":" suite)+
          ["else" ":" suite]
          ["finally" ":" suite]
try2_stmt: "try" ":" suite
          ("except" "﹡" expression ["as" identifier] ":" suite)+
          ["else" ":" suite]
          ["finally" ":" suite]
try3_stmt: "try" ":" suite
          "finally" ":" suite

Additional information on exceptions can be found in section Exceptions, and information on using the raise statement to generate exceptions may be found in section The raise statement.

Changed in version 3.14: Support for optionally dropping grouping parentheses when using multiple exception types. See PEP 758.

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •