#--encoding:utf-8--
#ListAndDic.py
list = [1, 4, 7]
dict = {1:11,2:22,4:44,8:88}
result = []
for i in list:
try:
result.append(dict[i]) #如果key相同則存儲,不同拋異常
except Exception,e:
print("不存在的key:"+str(e))
#do nothing
print(result)
# 不存在的key:7
# [11, 44]