0
In python the except block need to contain the error or we can just use it without the error name??
2 ответов
0
yes you can do a catch without any Exceptions in it, it should catch any Exceptions
try:
5/0 # throws ZeroDivisionError
except:
print("an error happened")
0
I can say from experience that catching all can lead to problem as the code gets more complex. Sometimes it's important to know exactly what error you are receiving to make your code run more smoothly