Python Play
Jump to navigation
Jump to search
1
[d['value'] for d in l]
2
list1 = ["a", "b" ,"c"] dictionary1 = {"a":1, "b":2, "c":3}
3
[d['value'] for d in l]
4
def to_dictionary(keys, values): return dict(zip(keys, values)) keys = ["a", "b", "c"] values = [2, 3, 4] print(to_dictionary(keys, values)) # {'a': 2, 'c': 4, 'b': 3}
5
[d['value'] for d in l if 'value' in d]
6
a
7
a