0

How to know the type of exception in python?

Is there any method to know the type of error. try: print(5/0) except ZeroDivisionError: print("Zero error occured:") try: name = "kevin" print(name/2) except Exception,e: error = str(e) #I saw this in Stackoverflow but this is not working print(e) Thanking you in advance <3

26th Jun 2017, 8:57 AM
S.Naveen Kumar
S.Naveen Kumar - avatar
1 Antwort
0
Hii guys I using raise to know the type of error. Is it good to use it???
26th Jun 2017, 9:14 AM
S.Naveen Kumar
S.Naveen Kumar - avatar