How to Pass a List's Items as Separate Arguments in Python with * (Star)
When the arguments a function needs are already in a list, * in front of the list passes each item as a separate argument: area(*[3, 4]) works like area(3, 4). This guide spreads a list into two calls on Python 3.15.2.
Syntax
<function>(*<list>)
| Part | What it means |
|---|---|
* | Unpacks the list into separate positional arguments, in order |
<list> | A list, tuple or any other iterable with one item per argument |
The Python language reference says: "If the syntax *expression appears in the function call, expression must evaluate to an iterable. Elements from these iterables are treated as if they were additional positional arguments."
The Example
area takes a width and a height. A room's size is stored as a list, [3, 4]. The script spreads it into area, and then spreads another list into print.
Prerequisites
- uv and Python 3. This guide uses uv 0.13.10 with Python 3.15.2, in a project made with
uv init.
Step 1: Write the Script
def area(width, height):
return width * height
size = [3, 4]
print(area(*size))
print(*["a", "b", "c"])
![The area.py script in a macOS-style code window: an area function with width and height, size = [3, 4], print(area(size)) and print(["a", "b", "c"]).](https://strdewiridedevblogsprod.blob.core.windows.net/images/blog/programming/python/2026/python-star-args-01-code.webp)
Step 2: Run It
uv run python area.py
12
a b c

area(*size) ran as area(3, 4) and returned 12. print(*["a", "b", "c"]) ran as print("a", "b", "c"), which prints the three items with spaces between them. The command works unchanged in PowerShell.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
More items than parameters: area(*[3, 4, 5]) | TypeError: area() takes 2 positional arguments but 3 were given | Pass a list with exactly as many items as the function takes |
Forgetting the star: area([3, 4]) | The whole list becomes width: TypeError: area() missing 1 required positional argument: 'height' | Add the * |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
takes 2 positional arguments but 3 were given | The list has more items than the function has parameters | Check the list's length |
missing 1 required positional argument | The list was passed without * | Write area(*size) |
FAQ
Does it work with a tuple?
Yes. area(*(3, 4)) also printed 12. Any iterable works.
What's the double star for?
** does the same for a dictionary, passing its keys and values as keyword arguments.
Conclusion
area(*size) spread [3, 4] into width and height and returned 12, and print(*items) printed each item. The list needs exactly one item per parameter, and the star is easy to forget.
Additional Resources
- Calls —
*and**in the language reference. - Unpacking Argument Lists — the Python tutorial.
