从键盘任意输入1个字符串s、捕捉并输出s=s+6的异常类型、异常内容和跟踪信息,并利用 finally输出“运行结束”
代码:
望采纳!谢谢
s = input()
try:
s = s + 6
except TypeError as t:
print("异常类型:TypeError,异常信息:{}".format(t))
finally:
print("运行结束")
s = input()
try:
s = s+6
except TypeError:
print("s = s+6")
print("TypeError: can only concatenate str (not int) to str")
else:
pass
finally:
print("运行结束")