Discussions Q&R
If 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 Votes
2 RéponsesPy
0 Vote
3 RéponsesAujourd'hui en vedette
Pull resistors
2 Votes
AI video creation
3 Votes
Sololearn chat en Español
1 Votes
Python
0 Votes
I'm confuse with this \n
1 Votes
How to make a game code
0 Votes
How to add image and audio
1 Votes
About create tuples [Solved]
0 Votes
Headless CMS
1 Votes
Missing]
0 Votes