Finally and except | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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 ответ
+ 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