0
Catch the syntaxError exception in python?
Hello All, I am just wondering how can we catch syntax error exception in python? Attached a sample code to do that. Any one from solo learn knows better way to do this? Please suggest. Thanks, SagaTheGreat đŻ https://code.sololearn.com/cP3X3COfu8Z4/?ref=app https://code.sololearn.com/cP3X3COfu8Z4/?ref=app
2 Answers
+ 3
The only catchable syntax errors is within an eval or exec. All others occur prior to the execution of your code so can't be caught.
+ 2
the only thing you can use to check a syntax error is your eyes and brain