thelist = [{'color':'green', 'time':4}, {'color':'red','time':2},{'color':'blue','time':5}]
怎么说:
If "red" is in thelist and time does not equal 2 for that element (that's we just got from the list):
请您参考如下方法:
使用 any()判断是否有满足条件的元素:
>>> any(item['color'] == 'red' and item['time'] != 2 for item in thelist)
False
