#python python3 pythonprogramming pythoncode pythoncrashcourse pythonforbiginners
Explore tagged Tumblr posts
pypatshala · 5 years ago
Video
youtube
Python Finally Clause
The try statement has another optional clause which is intended to define clean-up actions that must be executed under all circumstances. -Releasing resources. The code under finally block executes in all circumstances. - If a finally clause is present, the finally clause will execute as the last task before the try statement completes. - The finally block will be executed no matter if the try block raises an error or not. - If the try statement reaches a break, continue or return statement, the finally clause will execute just prior to the break, continue or return statement’s execution. - If a finally clause includes a return statement, the returned value will be the one from the finally clause’s return statement, not the value from the try clause’s return statement.
0 notes