fl = list(filter(lambda x: x['first'] == 'Christian', dictlist))
# you can't use `.property` because this is a dictionary, not a object
fl[0]['last']
# returns Doppler
d = dict(a=1, b=2, c=3, d=4, e=5)
print(d)
d1 = {x: d[x] for x in d.keys() if x not in ['a', 'b']}
print(d1)
{k: v for k, v in points.items() if v[0] < 5 and v[1] < 5}
dict
friends = [
{'name': 'Sam', 'gender': 'male', 'sport': 'Basketball'},
{'name': 'Emily', 'gender': 'female', 'sport': 'Volleyball'}
]
# filter by column names
print([{key: friend[key] for key in friend.keys() if key in ["name", "sport"]} for friend in friends])
# filter by rows
print([a for a in friends if a["name"] in ["Sam"]])