Exception Alias
When you catch an exception (error), you can save information about this exception using the as keyword.
The full alias structure:
except {error_type} as {variable_name}:
# code block
The alias allows us to display information about caught errors.
Look at the example:
1234567try: a = "string" + 10 except TypeError as error: print("TypeError:", error) print("The following code should be executed:") print("5 + 10 =", 5 + 10)
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 1. Capítulo 5
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Suggested prompts:
Pregunte me preguntas sobre este tema
Resumir este capítulo
Mostrar ejemplos del mundo real
Genial!
Completion tasa mejorada a 11.11
Exception Alias
Desliza para mostrar el menú
When you catch an exception (error), you can save information about this exception using the as keyword.
The full alias structure:
except {error_type} as {variable_name}:
# code block
The alias allows us to display information about caught errors.
Look at the example:
1234567try: a = "string" + 10 except TypeError as error: print("TypeError:", error) print("The following code should be executed:") print("5 + 10 =", 5 + 10)
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 1. Capítulo 5