Communities for your favorite technologies. Explore all Collectives
Now available on Stack Overflow for Teams! AI features where you work: search, IDE, and chat.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Get early access and see previews of new features.
Be pythonicPythonic. Use a comprehension:
z={k: v for d in [x,y] for k, v in d.items()} >>> print z {'a': 1, 'c': 11, 'b': 10}
Be pythonic. Use a comprehension:
Be Pythonic. Use a comprehension:
z={ik:d[i] v for d in [x,y] for ik, v in d.items()} >>> print z {'a': 1, 'c': 11, 'b': 10}
z={i:d[i] for d in [x,y] for i in d} >>> print z {'a': 1, 'c': 11, 'b': 10}
Be pythonic. Use a list comprehensioncomprehension:
Be pythonic. Use a list comprehension: