KeyError raised เมื่อ key ไม่อยู่ใน dictionary
ตัวอย่าง
import sys
try:
s = {'a':5, 'b':7}['c']
except:
print(sys.exc_info())
ผลลัพธ์
(, KeyError('c',), )
KeyError raised เมื่อ key ไม่อยู่ใน dictionary
import sys
try:
s = {'a':5, 'b':7}['c']
except:
print(sys.exc_info())
(, KeyError('c',), )