捕获所有异常:
try: code block #可能引发异常的语句 except Exception as e: print(e) #打印异常信息
如果知道可能引发的异常的类型,也可以将Exception替换成具体的异常类型。