What is the purpose of finally?
Exception handling
Audio flashcard · 0:14Nortren·
What is the purpose of finally?
0:14
The finally block runs whether or not an exception occurred and whether or not it was caught. It is the right place for cleanup actions like closing files, releasing locks, or restoring state. Even a return or break in the try or except runs the finally before exiting.
---
docs.python.org