Contact: aviboots(AT)netvision.net.il
43,956 questions
57,384 answers
573 users
x = 2345 y = 0 try: if y == 0: raise ZeroDivisionError("Error: divide by zero (y = 0)") x = x/y except Exception as e: print("Exception : " + repr(e)) ''' run: Exception : ZeroDivisionError('Error: divide by zero (y = 0)') '''
i = "python" try: if not type(i) is int: raise TypeError("i is not an int") except Exception as e: print("Exception : "+ repr(e)) ''' run: Exception : TypeError('i is not an int') '''