Зміст курсу
Error Handling in Python
Error Handling in Python
Exception Alias
When you catch an exception (error), you can save information about this exception using the as
keyword.
The full alias structure:
The alias allows us to display information about caught errors.
Look at the example:
try: a = "string" + 10 except TypeError as error: print("TypeError:", error) print("The following code should be executed:") print("5 + 10 =", 5 + 10)
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 5