Can someone please explain exceptions in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone please explain exceptions in python?

20th Jul 2017, 11:39 PM
Adrian Williamson
Adrian Williamson - avatar
4 Answers
+ 3
If you have your program do something, say open a file that doesn't exist, the program will crash. If you have the same program and have it "try" to open the file and if it doesn't exist it can catch the exception. instead of crashing it can do something else
21st Jul 2017, 12:47 AM
LordHill
LordHill - avatar
0
what concretely u can't understood? basically it's method for handing errors
21st Jul 2017, 12:08 AM
Mr. Nobody
Mr. Nobody - avatar
0
ohh. thanks
21st Jul 2017, 12:49 AM
Adrian Williamson
Adrian Williamson - avatar
0
An exception is an event, which occurs during the execution of a program that disrupts the normal flow of the program's instructions. In general, when a Python script encounters a situation that it cannot cope with, it raises an exception.
21st Jul 2017, 4:13 AM
Sudheer
Sudheer - avatar