Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobierenF&A Diskussionen
try-except & Boolean
1 Stimme
3 AntwortenPython
0 Stimmen
5 AntwortenIf except can handle common errors very well, doesn't that make the use of raise redundant inside of a try-except block?
For example:
try:
print( 5 / 0 )
except ZeroDivisionError:
raise ValueError("An error occurred!")
What's the difference if we handle it this way:
try:
print( 5 / 0 )
except (ZeroDivisionError, ValueError):
print("An error occurred!")
3 Stimmen
2 AntwortenHeute heiß
HTML Module 3 Quiz
2 Votes
Bits
4 Votes
How to cast in python : 2
2 Votes
No connection message
0 Votes
This error is showing.
0 Votes