【发布时间】:2022-11-29 20:20:39
【问题描述】:
我有以下字典列表,当前包含 None 值:
[{'connections': None}, {'connections': None}, {'connections': None}]
我想遍历元素列表,检查每个字典中的每个“连接”键是否为 None ,如果是则返回 true 。我如何检查所有值是否为 None?
【问题讨论】:
-
这回答了你的问题了吗? How to check if all elements of a list match a condition?(每个字典
d的条件为d['connections'] is None)
标签: python-3.x list dictionary