You can use a dict comprehension:
{k: v for k, v in points.items() if v[0] < 5 and v[1] < 5}
And in Python 2, starting from 2.7:
{k: v for k, v in points.iteritems() if v[0] < 5 and v[1] < 5}
More Related Contents:
- How to check if one dictionary is a subset of another larger dictionary?
- Convert array dictionary to a dictionary python
- Function to return results in a dictionary in Python
- Convert a String representation of a Dictionary to a dictionary?
- Why dict.get(key) instead of dict[key]?
- Remove duplicate dict in list in Python
- Change the name of a key in dictionary
- Using strides for an efficient moving average filter
- Finding a key recursively in a dictionary
- Is there a way to store a function in a list or dictionary so that when the index (or key) is called it fires off the stored function?
- In Python, how can you load YAML mappings as OrderedDicts?
- Hashing a dictionary?
- Convert dictionary entries into variables [duplicate]
- TypeError: ‘dict_keys’ object does not support indexing
- 5 maximum values in a python dictionary
- Creating a list of dictionaries with same keys? [duplicate]
- Make dictionary from list with python [duplicate]
- Using a Python Dictionary as a Key (Non-nested)
- Is there a recursive version of the dict.get() built-in?
- How can one make a dictionary with duplicate keys in Python?
- How do I return dictionary keys as a list in Python?
- Why can’t I use a list as a dict key in python? Exactly what can and cannot be used, and why?
- Python dictionary replace values
- How to get multiple dictionary values?
- Sort a list of tuples by second value, reverse=True and then by key, reverse=False
- python dict.add_by_value(dict_2)?
- differences between “d = dict()” and “d = {}”
- How to extract all values from a dictionary in Python?
- Determine whether a key is present in a dictionary [duplicate]
- Comparing 2 lists consisting of dictionaries with unique keys in python