+ 2

Why is it not working for SyntaxError?

I created a syntax error on purpose, though it doesn't return "due to invalid syntax" in my case. Why is it? try: num1 = 7 num2 = 9 print (num1 / num2))))))))) print("Done calculation") except SyntaxError: print("An error occurred") print("due to invalid syntax")

18th Sep 2016, 6:48 AM
Daniel Yang
Daniel  Yang - avatar
4 Réponses
+ 5
Due to the synthax error, python can't continue to read your program. Errors are not meant to be caught in general.
18th Sep 2016, 8:54 AM
Zen
Zen - avatar
+ 2
Only "SyntaxError"
18th Sep 2016, 8:47 AM
Daniel Yang
Daniel  Yang - avatar
0
What does it return?
18th Sep 2016, 8:46 AM
Tanmay Naik
Tanmay Naik - avatar
- 2
Daniel rape me please
19th Sep 2016, 2:20 AM
BOONDOCKS