You can do this:

s = dict([ (k,r) for k,r in mydict.iteritems() if r['x'] > 92 and r['x'] < 95 and r['y'] > 70 and r['y'] < 75 ])

This takes a dict as you specified and returns a 'filtered' dict.

Answer from adamk on Stack Overflow
🌐
DataCamp
datacamp.com β€Ί tutorial β€Ί python-dictionary-comprehension
Python Dictionary Comprehension Tutorial | DataCamp
December 4, 2024 - The syntax for dictionary comprehension in Python is as follows: {key:value for (key,value) in iterable} You can create a dictionary from a list using dictionary comprehension in Python by iterating over the list and setting the list elements as keys and values in the new dictionary.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί python-dictionary-comprehension
Python Dictionary Comprehension - GeeksforGeeks
April 18, 2026 - Dictionary comprehension is used to create a dictionary in a short and clear way. It allows keys and values to be generated from a loop in one line. This helps in building dictionaries directly without writing multiple statements.
🌐
Reddit
reddit.com β€Ί r/learnpython β€Ί create dictionary from list of dictionaries using list comprehension
r/learnpython on Reddit: Create dictionary from list of dictionaries using list comprehension
November 3, 2022 -

Original data:

list_of_dictionaries = [{'key1':'value1'},{'key2':'value2'},{'key3':['item1','item2','item3']}]

Desired output

{'key1':'value1','key2':'value2','key3': ['item1','item2','item3']}

Standart loop does the job, but i don't like it

empty_dictionary = {}
for item in list_of_dictionaries:
    for k, v in item.items():
        empty_dictionary[k] = v

How can i do it using list comprehension?

🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί create-a-dictionary-with-list-comprehension-in-python
Create a Dictionary with List Comprehension in Python - GeeksforGeeks
July 23, 2025 - By applying list comprehension, we can create a list of (index, value) pairs and convert it into a dictionary. It ensures a structured and ordered mapping of elements. ... Explanation: List comprehension iterates over enumerate(a), assigning ...
🌐
Ivan Kahl's Blog
blog.ivankahl.com β€Ί python-list-and-dictionary-comprehensions
Python Lists and Dictionary Comprehensions - Ivan Kahl
December 2, 2017 - The following is an example of a Python dictionary: ... A list comprehension processes data to return a list of values afterwards.
Find elsewhere
🌐
PythonHow
pythonhow.com β€Ί how β€Ί create-a-dictionary-with-list-comprehension
Here is how to create a dictionary with list comprehension in Python
New: Practice Python, JavaScript & SQL with AI feedback β€” Try ActiveSkill free β†’ Γ— ... # Example 1: Creating a dictionary from a list of values my_list = ['apple', 'banana', 'cherry', 'date'] my_dict = {value: len(value) for value in my_list} print(my_dict)
🌐
Towards Data Science
towardsdatascience.com β€Ί home β€Ί latest β€Ί 10 examples to master python dictionary comprehensions
10 Examples to Master Python Dictionary Comprehensions | Towards Data Science
January 18, 2025 - We can iterate over two iterables in a dictionary comprehension. words = ['data', 'science', 'machine', 'learning'] values = [5, 3, 1, 8] ... Key-value pairs are created by iterating over separate lists for keys and values.
🌐
Switowski
switowski.com β€Ί blog β€Ί dictionary-comprehension
Dictionary Comprehension - Sebastian Witowski
January 19, 2023 - We can simplify our code by passing a list of key-value tuples directly to the dict() function: ... Before Python 2.7, this was the simplest way to build a dictionary from an iterable. It's not bad, but all those brackets and parentheses can be slightly confusing. With the release of Python 2.7.3, PEP 274 introduced dictionary comprehension...
🌐
Netguru
netguru.com β€Ί home page β€Ί blog β€Ί python basics: list comprehensions, dictionary comprehensions and generator expressions
Python Basics: List Comprehensions, Dictionary Comprehensions and Generator Expressions
September 28, 2023 - In Python, dictionary comprehensions are very similar to list comprehensions – only for dictionaries. They provide an elegant method of creating a dictionary from an iterable or transforming one dictionary into another.
🌐
Python documentation
docs.python.org β€Ί 3 β€Ί tutorial β€Ί datastructures.html
5. Data Structures β€” Python 3.14.6 documentation
A list comprehension consists of brackets containing an expression followed by a for clause, then zero or more for or if clauses. The result will be a new list resulting from evaluating the expression in the context of the for and if clauses ...
🌐
Medium
medium.com β€Ί @vinodkumargr β€Ί list-dictionary-and-set-comprehension-in-python-9823719a67da
LIST , DICTIONARY AND SET COMPREHENSION IN PYTHON | by Vinod Kumar G R | Medium
April 3, 2023 - ... The answer is yes, python supports Dictionary comprehension. ... Dictionary comprehension is a method for transforming one dictionary into another dictionary. During this transformation, items within the original dictionary can be conditionally ...
🌐
DEV Community
dev.to β€Ί michaelcurrin β€Ί dict-comprehensions-in-python-3hl7
Dictionary comprehensions in Python - DEV Community
November 7, 2020 - Here we convert a list to a dictionary, using the list item as the key and a computed value as the value. def square(x): return x**2 a = [1, 2, 3] b = { x: square(x) for x in a } b # {1: 1, 2: 4, 3: 9} You can use a dictionary comprehension to transform a dictionary...
🌐
YouTube
youtube.com β€Ί watch
Python Dictionary Comprehensions - YouTube
Comprehensions are a powerful tool in Python that allow you to create new lists, sets and dictionaries, populated with values. This video explains how Dict c...
Published Β  May 9, 2023
🌐
Real Python
realpython.com β€Ί python-dictionary-comprehension
Python Dictionary Comprehensions: How and When to Use Them – Real Python
October 14, 2024 - In dictionary comprehension, the expression must provide the key and its corresponding value, key: value. Both elements can be expressions. The current member: This is the current item or value in the iterable.
🌐
freeCodeCamp
freecodecamp.org β€Ί news β€Ί dictionary-comprehension-in-python-explained-with-examples
Dictionary Comprehension in Python – Explained with Examples
August 24, 2021 - We can now use Python's zip() function to zip these two lists to generate the key-value pairs. Note: The zip function takes in a sequence of iterables as the argument, and returns an iterator of tuples, as shown in the image below. So, the first tuple is the first key-value pair, the second tuple is the second key-value pair, and in general, the i-th tuple is the i-th key-value pair. In this case, the dictionary comprehension takes the following form:
🌐
Dataquest
dataquest.io β€Ί home β€Ί blog β€Ί python dictionary comprehension tutorial (with 39 code examples)
Python Dictionary Comprehension Tutorial (with 39 Examples)
March 6, 2023 - Before that, though, let's remind ourselves what is comprehension in Python. It simply means applying a specific kind of operation on each element of an iterator (such as a list, dictionary, ...