Finally and except | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Finally and except

Does the code continue to run after except? If yes then why is there need for finally?

18th Sep 2020, 2:36 PM
Bojan Jovanovic
Bojan Jovanovic - avatar
1 Answer
+ 7
Yes codes after except also run. Finally code block always executes even if there occurs an error. This is helpful in manipulating files. when in finally block you close the file even if there occurs an error
18th Sep 2020, 2:52 PM
TOLUENE
TOLUENE - avatar