我是python的新手,我一直想知道你是否可以在python中做这样的事情。
try:
something():
if it throws an exception then try this:
something1():
if it throws an exception again:
print(exception)
答案 0 :(得分:1)
当然可以。
try:
something()
except Exception as exp:
try:
something1()
except Exception as exp2:
print(exp, exp2)
raise exp # in case you want to raise the original exception