Advertisement
  1. Code
  2. Python
Code

What Are List Comprehensions in Python?

by
Difficulty:BeginnerLength:QuickLanguages:
 

"List comprehension" is a big name for a really simple concept. In the world of Python, a list comprehension is nothing more than a shorthand way to create a new list. 

In this short video from my course on Data Handling With Python, I'll show you how list comprehensions can cut your code from several lines down to a single one in many cases.

List comprehensions in Python

Watch the Full Course

If you've started learning Python, you probably have a good feel for the basics, but when you look around on the internet there are more things that you still don't understand. Maybe you've been hearing about "comprehensions". Or maybe you've seen the map or filter functions used and wonder exactly what they do. What about files? How do you read from them or write to them?

If you've ever wanted to go deeper with Python, then the full course, Data Handling With Python, is ideal for you. 

For starters, you'll learn about advanced use of commonly used data structures. Later on, I'll share some pointers with you about how to get data in and out of files and even store complex data structures in them.

Advertisement
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.