try:
a = int(input('请输⼊第⼀个整数'))
b = int(input('请输⼊第⼆个整数'))
result = a / b
print('结果为:', result)
except ZeroDivisionError:
print('除数不能为0!')
except ValueError:
print('请输⼊数字串!')
except BaseException as e:
print(e)
print('程序结束')
try:
a = int(input('请输⼊第⼀个整数'))
b = int(input('请输⼊第⼆个整数'))
result = a / b
except BaseException as e:
print('出错了,错误为:',e)
else:
print('结果为:', result)
print('程序结束')
# 请输⼊第⼀个整数a
# 出错了,错误为: invalid literal for int() with base 10: 'a'
# 程序结束
# 请输⼊第⼀个整数10
# 请输⼊第⼆个整数0
# 出错了,错误为: division by zero
# 程序结束