【发布时间】:2013-04-29 13:12:33
【问题描述】:
我有 3 个字典
a = {1:'this' ,2:'is' ,3:'an' ,4:'example'}
b = {4:'this' ,5:'is' ,6:'example'}
c = {7:'this' ,8:'is'}
还有这个
for i in range(10):
print a[i] ,b[i] ,c[i]
它会导致 KeyError,我如何知道三个字典中的哪一个引发了错误?有什么简单的方法。
感谢您的任何帮助。
【问题讨论】:
-
拆分成多行...或者使用调试器
标签: python exception dictionary try-catch keyerror