0
What is the use of raising exceptions?
I tried but failed to understand.
7 Respuestas
+ 6
Notice how you can write the error message with more information inside the parentheses.
name = "123"
try:
raise NameError("Invalid name!")
except NameError:
print('NameError : "Invalid name!"')
__________________________
Notice you can even do this way:
name = "123"
try:
raise NameError
except NameError:
print('NameError : "Invalid name!"')
Read this article: https://geek-university.com/JUMP_LINK__&&__python__&&__JUMP_LINK/raise-exception/
+ 5
https://www.sololearn.com/post/482594/?ref=app
https://www.sololearn.com/discuss/221589/?ref=app
https://www.sololearn.com/discuss/588273/?ref=app
https://www.sololearn.com/discuss/2015076/?ref=app
https://www.sololearn.com/discuss/1915762/?ref=app
+ 4
this might help you.
https://code.sololearn.com/c7s72VWhU4QS/?ref=app
+ 1
rohit in simple word raise allows you to raise your own exceptions?
+ 1
rohit the raise statement can be used without arguments to re-raise whatever exception occurred.
Could you explain this line?
+ 1
rohit
We can use the raise keyword to signal that the situation is exceptional to the normal flow.
0
Am i correct or not?