I have the following list of dictionaries, that currently contain None values:
[{'connections': None}, {'connections': None}, {'connections': None}]
I want to loop through the list of elements, check if each "connections" key in each dictionary is None and return true if so. How can i check if all values are None?
>Solution :
You can use a generator expression and all to unpack all the dict values in lst and check if they are all None:
out = all(x is None for d in lst for x in d.values())
Output:
True