展望的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