+ 1

Can I place the finally block before except block ?

Means if I don't want any type of error then can I remove the exception suite and just type the finally block

17th Mar 2019, 6:39 AM
Shikhar Nagle
Shikhar Nagle - avatar
2 Antworten
+ 2
You should place those statements in this block that must be executed always. ... In normal case when there is no exception in try block then thefinally block is executed after tryblock. However if an exception occurs then the catch block is executedbefore finally block.. 😉
17th Mar 2019, 6:58 AM
Max Andal
Max Andal - avatar
+ 2
You still need the exception block only that it is empty in most language (pass in Python).
17th Mar 2019, 7:16 AM
Gordon
Gordon - avatar