In this video tutorial we will discuss about finally keyword in python programming
The finally block in python is used to execute a block of code regardless of whether an exception occurs or not.
The Finally block always executes, regardless of whether an exception occurs.
It is useful for cleanup operations ( closing files, releasing resources)
Even if a function has a return, the finally block executes before the return statement completes.
If you want to break your database connection because some error has occurred, and you want to remove your database connection.
So, finally block is used for the purposes mentioned above.
Check the practical examples of finally keyword and why we use finally keyword in python
#finallykeywordinpython #CrackITwithAnu #pythonfinally #finallyinpython #tryandfinallyinpython #tryexceptandfinally #learnpython #pythonprogramming