展望的20搜索字典值
歲以上算在字典中的男性的數量,我有以下字典
i={'joe':("male",25), 'fred':("male",39), 'susan':("female",20)}
我知道如何搜索字典的關鍵例如
print ('joe' in i)
返回true,但
print ('male' in i.values())
print ('male in i)
都返回false。我怎樣才能得到它返回true 最終我試圖計算男性人數超過一定年齡的字典中的
謝謝 - 我怎麼會那麼檢查的男性有一定的年齡段之間 – chrischris
@chrischris就在表達式的末尾添加條件。 – Kasramvd