+ 1

Why do we need 'finally' in Python?

8th May 2017, 12:21 PM
Alexander Ryabchikov
Alexander Ryabchikov - avatar
3 ответов
+ 5
I'll give an example: if you need to work with a file, and an error occured, you NEED to close the file, whether there was an exception or not. The finally clause does just that
8th May 2017, 12:42 PM
Amaras A
Amaras A - avatar
+ 5
Now you saw? Then try it, dont see and leave #advice
8th May 2017, 1:02 PM
Meharban Singh
Meharban Singh - avatar
+ 2
Thanks. Now i see.
8th May 2017, 12:44 PM
Alexander Ryabchikov
Alexander Ryabchikov - avatar