+ 3
in java we can tell what's the exact error by using catch(Exception e){ e.printStackTrace(); //or System.out.println(e.getMessage()); // or just printing the exception class } is that possible in python in any way ?
5 Réponses
+ 4
It doesnt work with finally out the loop try-except?
+ 2
You have the reserved words try, except and raise to use them in the same way you do with catch in Java. Look for examples in the lessons of the app dedicated to exceptions.
+ 2
it worked with finally .. it prints the error at the bottom .. but that's okay as long as the rest of the code still running :D
thanx a lot @Carlos Sacanell
+ 2
You are welcome mate! 😀
+ 1
yeah I know about try,except and raise .. but I need to print an explanation of what's going on when I use the general "except" without a specific type .. I need to print the type of the error without using "raise" inside except
block and making my code stop executing
@Carlos Sacanell