+ 1

Can I use except keyword two times???

While I using it says default except must be last .. how it is try: Print (7/0) except: Print (6/0) except: Print("how's") It's shows error

19th Feb 2021, 1:11 PM
Ramana Prasad j
Ramana Prasad j - avatar
3 Answers
+ 1
In the first except you created Devision by zero error... You have to avoid that
19th Feb 2021, 1:18 PM
Tomas Konecny
+ 1
Also read about use of 'else' and 'finally'. Sooner or later it might help you too
19th Feb 2021, 1:22 PM
Tomas Konecny
0
not in this case: you should nest try/catch blocks: try: print(7/10) except: try: print(6/10) except: print('how\'s') you could only use many except statements as soon as you provide different kind of exception ^^
19th Feb 2021, 1:17 PM
visph
visph - avatar