KeyError object.
log = []
for make in (ValueError, ValueError("bad"), KeyError("k")):
try:
raise make
except ValueError as e:
log.append(len(e.args))
except Exception as e:
log.append(str(e))
print(log)
What does the program print?Log in to join the discussion.
Loading…