[1 / 1 / ?]
Quoted By:
i have a list of dictionaries in python and i want to check if a key exists in all of them
how would i do this?
my code looks something like this so far:
a = [
{"john":"male", "jane":"female"},
{"bob":"male", "jane":"female"},
{"dave":"male", "jane":"female"}
]
for x in a:
for i in x:
if all(i in a[dics] for dics in a):
print(i)
but it obviously doesn't work
pls no bully i am a brainlet
how would i do this?
my code looks something like this so far:
a = [
{"john":"male", "jane":"female"},
{"bob":"male", "jane":"female"},
{"dave":"male", "jane":"female"}
]
for x in a:
for i in x:
if all(i in a[dics] for dics in a):
print(i)
but it obviously doesn't work
pls no bully i am a brainlet