The Python map() function calls a function on every item of an iterable and gives you the results one at a time. Write map(function, iterable), then wrap it in list() when you want a list back:
print(list(map(int, ["7", "42", "350"]))) # [7, 42, 350]
For the record, I tested these snippets with Python 3.12.5 (and Python 3.14.8 for the newer strict= keyword) on Windows 11; outputs are copied straight from Command Prompt.
In this tutorial, we’ll cover the syntax, the lazy map object, built-ins, lambdas, multiple iterables, list comprehensions and common errors.
What is the syntax of the map() function in Python?
The full signature is map(function, iterable, *iterables, strict=False). You pass the function itself, without parentheses, and Python calls it once per item. Here’s a sales-tax helper applied to a few prices:
def add_tax(price):
return round(price * 1.0825, 2)
prices = [19.99, 5.49, 120.00, 64.50]
taxed = map(add_tax, prices)
print(taxed)
print(list(taxed))
print(list(taxed))
Output:
<map object at 0x000001F1892A8D30>
[21.64, 5.94, 129.9, 69.82]
[]

That empty list catches a lot of people. A map object is a lazy iterator: it computes values only when you loop over it, and only once.
Need the results twice? Store list(map(...)) in a variable. A for loop over a list also works on the map object directly.
How do you use map() with built-in functions like int() and str()?
Any callable works, so built-ins and string methods are the cleanest choice. Converting text from a CSV row is the classic case:
row = "19.99, 5.49, 120.00, 64.50"
amounts = list(map(float, row.split(",")))
print(amounts)
zip_codes = list(map(int, ["10001", "60601", "94105"]))
print(zip_codes, sum(map(len, ["NY", "IL", "CA"])))
states = [" texas", "ohio ", " new york"]
print(list(map(str.title, map(str.strip, states))))
print("-".join(map(str, [2026, 10, 20])))
Output:
[19.99, 5.49, 120.0, 64.5]
[10001, 60601, 94105] 6
['Texas', 'Ohio', 'New York']
2026-10-20

float, ZIP codes with int, state names cleaned by two chained maps, and a date joined with str.Notice str.strip has no parentheses; you’re handing over the method. If you’re unsure whether something can be passed, check the callable() function. More options are in the Python built-in functions list.
Use map() with a lambda and multiple iterables
When no built-in fits, a lambda keeps the logic inline. Pass two or more iterables and the function gets one item from each, in parallel:
units = [3, 1, 4]
unit_prices = [12.50, 89.99, 4.25, 7.00]
line_totals = list(map(lambda q, p: round(q * p, 2), units, unit_prices))
print([f"${t:.2f}" for t in line_totals])
print(f"Order total: ${sum(line_totals):.2f}")
print(list(map(pow, [2, 3, 4], [3, 2])))
Output:
['$37.50', '$89.99', '$17.00']
Order total: $144.49
[8, 9]

The extra price, $7.00, just disappears, and pow stops after two results. That’s the same rule zip() follows; see the zip() function in Python. For more lambda patterns, read how to use lambda functions in Python.
Does map() have a strict parameter in Python 3.14?
Yes. Python 3.14 added strict=True, which raises ValueError instead of silently dropping extra items:
import sys
units = [3, 1, 4]
unit_prices = [12.50, 89.99, 4.25, 7.00]
print("Python", sys.version.split()[0])
try:
print(list(map(lambda q, p: q * p, units, unit_prices, strict=True)))
except ValueError as err:
print("ValueError:", err)
Output:
Python 3.14.8
ValueError: map() argument 2 is longer than argument 1

ValueError saying argument 2 is longer than argument 1.On Python 3.12 the same keyword fails before any mapping starts:
try:
map(pow, [2, 3], [3, 2], strict=True)
except TypeError as err:
print("TypeError:", err)
Output:
TypeError: map() takes no keyword arguments
So use strict=True only when your code requires 3.14 or later.
map() vs list comprehension: which should you use?
Both produce the same values. Here’s a 20% discount both ways, then with a filter step:
prices = [19.99, 5.49, 120.00, 64.50]
print(list(map(lambda p: round(p * 0.8, 2), prices)))
print([round(p * 0.8, 2) for p in prices])
print(list(map(lambda p: round(p * 0.8, 2), filter(lambda p: p > 20, prices))))
print([round(p * 0.8, 2) for p in prices if p > 20])
Output:
[15.99, 4.39, 96.0, 51.6]
[15.99, 4.39, 96.0, 51.6]
[96.0, 51.6]
[96.0, 51.6]
I reach for map() when I already have a named function, like map(int, parts). With a lambda plus filter(), a list comprehension reads better. Filtering lists in Python covers the filter side.
Common map() errors in Python and how to fix them
Three mistakes cause most map() bugs: passing a non-function, calling the function instead of passing it, and feeding values the function can’t handle:
try:
list(map(5, [1, 2]))
except TypeError as err:
print("TypeError:", err)
try:
list(map(str.upper(), ["ny", "ca"]))
except TypeError as err:
print("TypeError:", err)
try:
list(map(int, ["10001", "N/A"]))
except ValueError as err:
print("ValueError:", err)
Output:
TypeError: 'int' object is not callable
TypeError: unbound method str.upper() needs an argument
ValueError: invalid literal for int() with base 10: 'N/A'
The first two raise TypeError; drop the parentheses or pass a real function. The ValueError comes from int() itself, and it appears only when the map is consumed.
To fold mapped values into one total, use the reduce() function in Python.
Working with functions in data code? Pick one of these next:
- Lambda functions on a pandas DataFrame
- Pass a function as a parameter in Python
- Define a function in Python
- Convert an int to a string in Python
Frequently asked questions
What does the map() function return in Python 3?
It returns a map object, which is a lazy iterator. Wrap it in list(), tuple() or set() to see all the values.
Why does my map object print as empty the second time?
An iterator can be read only once. After list() uses it up, later reads return nothing, so save the list instead.
Can map() take more than one iterable?
Yes. The function takes one argument per iterable, and mapping stops at the shortest one unless you pass strict=True (3.14+).
Is map() faster than a list comprehension?
Often slightly, with a built-in like int. With a lambda the gap is tiny, so pick what reads best.
How do I convert a list of strings to integers with map()?
Use list(map(int, values)). Every string must be a valid whole number, or int() raises a ValueError.
Where is map() documented officially?
See map() in the Python built-in functions docs, including the 3.14 strict change.

Bijay Kumar is a 13-time Microsoft MVP with more than 18 years in software development, and the founder of Python Guides and TSinfo Technologies. He started out building .NET and SharePoint solutions at HP, TCS and KPIT before moving into Python, machine learning and AI, and he also builds web apps with TypeScript and React. He writes the tutorials here himself, and every example is run before publishing so you see the real output. More about Bijay · Microsoft MVP profile · LinkedIn