0

Only "Except" always at the end?

This code doesn't work but if I put except at the end of the code works properly... So always the "except" must be at the end? //// try: word = 2 print(word / 0) except: print("An error occurred") except ZeroDivisionError: print ("Dividiendo con cero") /// RUN //// File "..\Playground\", line 3 ^ SyntaxError: default 'except:' must be last ////

13th Oct 2016, 5:06 PM
Santiago Brescia
Santiago Brescia - avatar
2 Réponses
0
This is just the way python does things first it wants to check what to do if specific exceptions are thrown then it likes to know what to do if any of the other types of exceptions are thrown.
29th Oct 2016, 12:53 PM
Brian
0
i is very interesting
12th Jun 2019, 9:27 AM
S.Vigneshwaran