标签:包含 字典 apple div TE ota 计算 def int
allGuests = { ‘A‘:{‘apples‘:5,‘pretzels‘:12}, ‘B‘:{‘hs‘:3,‘apples‘:2} } def total(guests,item): num = 0 for k in guests: num = num +guests[k].get(item,0) return num print(str(total(allGuests,‘apples‘)))#计算字典中某个键对应的数量之和
标签:包含 字典 apple div TE ota 计算 def int
原文地址:https://www.cnblogs.com/xlsxls/p/9199839.html