Catch the syntaxError exception in python? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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