Answers for "filter on dict python"

0

filter list dict

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
Posted by: Guest on October-18-2021
1

filter dict

{k: v for k, v in points.items() if v[0] < 5 and v[1] < 5}
Posted by: Guest on June-12-2020

Python Answers by Framework

Browse Popular Code Answers by Language