Treating errors in Python

try: # code to try
except Exception as ex: # execute on error
else: # execute only if no errors
finally: # always execute

Remarks:

Related:

References: