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

25th Jun 2018, 5:16 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
2 Antworten
+ 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.
25th Jun 2018, 8:45 PM
John Wells
John Wells - avatar
+ 2
the only thing you can use to check a syntax error is your eyes and brain
25th Jun 2018, 5:54 PM
hinanawi
hinanawi - avatar