The typical structure for exception handling is below:
try:
pass
except Exception, e:
raise
else:
pass
finally:
pass
May I know what does except Exception, e:
orexcept Exception as e:
mean?
Typically I will use print (e)
to print the error message but I am wondering what the program has done to generate the e.
If I were to construct it in another way (below), how would it be like?
except Exception:
e = Exception.something
What should the method be to replace the something
?
When the body of code under try
gives no exception, the program will execute the code under else
. But, what does finally
do here?