Recently, we looked at list comprehensions in Python. Similar to its sibling the list comprehension, a dictionary comprehension is nothing more than a shorthand way of creating a new dictionary collection. While it may seem a little more complicated than the list version, it is actually quite simple to understand.
In this video tutorial from my course on Data Handling With Python, I’ll show you exactly what dictionary comprehensions are and how you can use them.
Watch the Full Course
Do you want to learn Python in depth? If so, the full course, Data Handling With Python, is for you. It goes beyond the basics and takes you through Python data management in detail. Beyond comprehensions, we’ll also look at map, filter, lambdas, and generators, as well as reading and writing to files and complex objects.
And if you want something even more comprehensive, try my seven-hour course Learn to Code With Python, which includes the lessons on data management but also covers a whole lot more aspects of the Python language.