19. Raise Exception And Finally [Python 3 Programming Tutorials]

preview_player
Показать описание
In this video, we are using raise exception in python and use finally.

Next Video:

Рекомендации по теме
Комментарии
Автор

00:01 Video covers how to raise standard and user-defined exceptions, and the 'finally' keyword in Python.
01:18 Raising exceptions using 'raise' keyword
02:22 Creating a custom exception class in Python
03:53 Exceptions are unusual scenarios that occur during code execution.
04:45 Using 'raise' for exceptions and 'finally' for cleanup.
06:00 Handling exceptions is crucial to prevent unexpected errors
06:57 Using the 'finally' keyword to handle exceptions
08:11 Finally block ensures file cleanup even if exception occurs in try-except block.

zakariya-ww
Автор

i didn't get that for what purpose the raise is used, can you please bring more light on it sir?

parekhakhil
Автор

In the finally block example, if there is actually a FileNotFoundError, f.close() will not work as f was not assigned in the first place and does not exist

thisisvikaas
Автор

The raise part wasn't clear....can you explain that a bit

sayantanisaha