try: b=4/0 except ZeroDivisionError: print("获取 ZeroDivisionError ") ''' 获取 ZeroDivisionError '''
try: b=4/0 except ZeroDivisionError as e:# 获取更详细的信息 print('获取 ZeroDivisionError ',e) ''' 获取 ZeroDivisionError division by zero '''
标签:except,try,获取,ZeroDivisionError,print,异常 From: https://www.cnblogs.com/haha1988/p/17529694.html