Get Multiple Values from a List in Python

Recently, I was working on a data‑processing project where I needed to extract specific elements from a long list of U.S. city names. The challenge? I didn’t want just one value; I needed multiple values at once from different positions in the list.

If you’ve worked with lists in Python, you already know how flexible they are. However, getting multiple values efficiently can be a bit tricky if you don’t know the right techniques.

In this tutorial, I’ll share five practical ways I use to get multiple values from a Python list.
Each method is simple, beginner‑friendly, and something I’ve personally used in real‑world projects.

Method 1 – Get Multiple Values Using Python List Slicing

Python’s slicing feature is one of the easiest ways to access multiple values from a list. It allows you to extract a portion of the list by specifying start, stop, and step indexes.

Here’s a simple example:

cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio"]

# Get the first three cities
top_three = cities[0:3]

# Get every second city
alternate_cities = cities[::2]

print("Top three cities:", top_three)
print("Alternate cities:", alternate_cities)

When I run this Python code, it prints:

Top three cities: ['New York', 'Los Angeles', 'Chicago']
Alternate cities: ['New York', 'Chicago', 'Phoenix', 'San Antonio']

You can see the output in the screenshot below.

return python multiple values

I often use slicing when I want a continuous block of elements or when I need to skip items using the step parameter. It’s clean, readable, and very Pythonic.

Method 2 – Get Multiple Values Using Python List Comprehension

List comprehension is one of my favorite Python features. It’s concise, elegant, and perfect for selecting multiple values based on conditions.

Here’s an example where I extract all cities with names longer than 8 characters:

cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio"]

# Extract cities with names longer than 8 characters
long_city_names = [city for city in cities if len(city) > 8]

print("Cities with long names:", long_city_names)

Output:

Cities with long names: ['Los Angeles', 'Philadelphia', 'San Antonio']

You can see the output in the screenshot below.

python return multiple lists

I use this technique whenever I need to filter lists dynamically. It’s especially useful when working with large datasets, like filtering U.S. ZIP codes or product lists.

Method 3 – Get Multiple Values Using Python Indexing and Loops

Sometimes, I already know the exact indexes of the items I need. In such cases, I can use a simple loop or a list comprehension to grab those specific elements.

Here’s how I do it:

cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio"]

# Let's say I want the 1st, 3rd, and 5th cities
indexes = [0, 2, 4]

# Extract values using list comprehension
selected_cities = [cities[i] for i in indexes]

print("Selected cities:", selected_cities)

Output:

Selected cities: ['New York', 'Chicago', 'Phoenix']

You can see the output in the screenshot below.

get value from list python

This approach gives me full control. It’s great when working with lists where only certain positions matter, like pulling specific columns from CSV data.

Method 4 – Get Multiple Values Using Python Unpacking

Python’s unpacking feature lets you assign multiple list values to variables in one go. It’s a clean and readable way to extract several values quickly.

Here’s a simple demonstration:

numbers = [10, 20, 30, 40, 50]

# Unpack first three values
a, b, c, *rest = numbers

print("a:", a)
print("b:", b)
print("c:", c)
print("Remaining values:", rest)

Output:

a: 10
b: 20
c: 30
Remaining values: [40, 50]

You can see the output in the screenshot below.

python list contains multiple items

I often use unpacking when I know the structure of the list in advance. It’s also a great way to make Python code more readable and maintainable.

Method 5 – Get Multiple Values Using the operator.itemgetter() Function

When I need to extract multiple values from a list based on indexes efficiently, I use the itemgetter() function from Python’s operator module. It’s faster than list comprehension in many cases and works beautifully with large datasets.

Here’s an example:

from operator import itemgetter

cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio"]

# Get 2nd, 4th, and 6th cities
getter = itemgetter(1, 3, 5)
selected_cities = getter(cities)

print("Selected cities:", selected_cities)

Output:

Selected cities: ('Los Angeles', 'Houston', 'Philadelphia')

This method is particularly useful when performance matters. I use it in data analytics scripts where I need to extract multiple fields quickly from large lists.

Bonus Tip – Get Multiple Values Using Python map() Function

The map() function can also help when you want to transform or extract multiple values from a list. It’s especially handy when you’re applying a function to each selected element.

Here’s a quick example:

numbers = [100, 200, 300, 400, 500]

# Double selected numbers (1st, 3rd, 5th)
indexes = [0, 2, 4]
selected_numbers = [numbers[i] for i in indexes]

# Use map to double the selected values
doubled = list(map(lambda x: x * 2, selected_numbers))

print("Original selected numbers:", selected_numbers)
print("Doubled values:", doubled)

Output:

Original selected numbers: [100, 300, 500]
Doubled values: [200, 600, 1000]

I use this method when I need to process multiple values simultaneously, for example, adjusting prices or scaling numeric data.

Real‑World Example – Extract Multiple Values from a List of Dictionaries

In real projects, I often deal with lists of dictionaries, especially when handling JSON data from APIs. Let’s say I have a list of U.S. employee records, and I want to extract their names and salaries.

Here’s how I can do it:

employees = [
    {"name": "John", "city": "New York", "salary": 75000},
    {"name": "Emma", "city": "Los Angeles", "salary": 82000},
    {"name": "Liam", "city": "Chicago", "salary": 68000},
    {"name": "Olivia", "city": "Houston", "salary": 91000},
    {"name": "Noah", "city": "Phoenix", "salary": 72000}
]

# Extract names and salaries using list comprehension
names = [emp["name"] for emp in employees]
salaries = [emp["salary"] for emp in employees]

print("Employee Names:", names)
print("Employee Salaries:", salaries)

Output:

Employee Names: ['John', 'Emma', 'Liam', 'Olivia', 'Noah']
Employee Salaries: [75000, 82000, 68000, 91000, 72000]

This is one of my go‑to Python patterns when working with structured data. It’s fast, readable, and works well with APIs, CSVs, or database queries.

Getting multiple values from a list in Python is something I do almost daily. Whether I’m analyzing data, cleaning CSV files, or building automation scripts, these methods save me time and make my code cleaner.

If you’re new to Python, start with slicing and list comprehension; they’re intuitive and powerful. As you grow more confident, explore unpacking and itemgetter() for more advanced use cases.

You may also read:

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.