The finally clause in Python is an optional clause that can be added to a try/except block. It is intended to define clean-up actions that must be executed under all circumstances.
A finally clause is always executed before leaving the try statement, whether an exception has occurred or not. Its primary purpose is to let you execute code regardless of what the try and except blocks result in.