You can use x = func()[0] to return the first value, x = func()[1] to return the second, and so on.

If you want to get multiple values at a time, use something like x, y = func()[2:4].

Answer from Luke Woodward on Stack Overflow
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
How to Return Multiple Values from a Function in Python | note.nkmk.me
April 23, 2025 - def test_list(): return ['abc', 100] result = test_list() print(result) print(type(result)) # ['abc', 100] # <class 'list'> ... Draw circle, rectangle, line, etc. with Python, Pillow ยท pandas: Reset index of DataFrame/Series with reset_index() Convert Unix Time (Epoch Time) to and from datetime in Python ยท NumPy: Create an array with the same value (np.zeros, np.ones, np.full)
๐ŸŒ
Real Python
realpython.com โ€บ python-return-statement
The Python return Statement: Usage and Best Practices โ€“ Real Python
June 14, 2024 - Python functions are not restricted to having a single return statement. If a given function has more than one return statement, then the first one encountered will determine the end of the functionโ€™s execution and also its return value.
๐ŸŒ
Reddit
reddit.com โ€บ r/python โ€บ can a function return more than 1 value in python
r/Python on Reddit: Can a function return more than 1 value in Python
March 25, 2021 -

I'm in 11th grade. My class is having a big discussion over this. So I chose to ask you all what is the truth.

Can functions in python return more than 1 value?

I told my teacher no they can't because the function returns a tuple containing multiple values so it's technically a single object that is getting returned (when we write something like return v1,v2 ) and when we are assigning those values to variables, we are just unpacking tuples.

I really need your help. What do you think?

Edit: Thank you all for your answers. I have come to the conclusion that this debate is more semantic/linguistic than technical. I have decided to stick to what my teacher teaches me just so I can get the correct answer on the school tests.

๐ŸŒ
Career Karma
careerkarma.com โ€บ blog โ€บ python โ€บ python: return multiple values from a function
Python: Return Multiple Values from a Function | Career Karma
December 1, 2023 - It can be used to return multiple values to a main program. You can return multiple values by separating the values you want to return with commas. These values should appear after your Python return statement.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-returns-multiple-values-how-to-return-a-tuple-list-dictionary
Python Return Multiple Values โ€“ How to Return a Tuple, List, or Dictionary
July 20, 2020 - To do so, return a data structure that contains multiple values, like a list containing the number of miles to run each week. def miles_to_run(minimum_miles): week_1 = minimum_miles + 2 week_2 = minimum_miles + 4 week_3 = minimum_miles + 6 return [week_1, week_2, week_3] print(miles_to_run(2)) # result: [4, 6, 8] Data structures in Python are used to store collections of data, which can be returned from functions.
๐ŸŒ
Boot.dev
boot.dev โ€บ lessons โ€บ 3c5fe40f-41e3-4d7e-a035-be67c8d83536
Learn to Code in Python: Multiple Return Values | Boot.dev
A function can return more than one value by separating them with commas. def cast_iceblast(wizard_level, start_mana): damage = wizard_level * 2 new_mana = start_mana - 10 return damage, new_mana # return two values ยท When calling a function ...
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ g-fact-41-multiple-return-values-in-python
Returning Multiple Values in Python - GeeksforGeeks
In Python, a function can return more than one value at a time using commas. These values are usually returned as a tuple. This is useful when a function needs to give back several related results together.
Published ย  July 1, 2025
๐ŸŒ
Flexiple
flexiple.com โ€บ python โ€บ python-return-multiple-values
Return multiple values from a function in Python | Flexiple Tutorials - Flexiple
Python basically uses a tuple to achieve this. ... #Returning Multiple Values using Tuples def multiple(): operation = "Sum" total = 5+10 return operation, total; operation, total = multiple() print(operation, total) #Output = Sum 15
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ python-return-multiple-values-use-only-one
Return multiple values and only use One in Python | bobbyhadz
Call the function and use slicing if you need to get multiple values. ... Copied!def my_func(): return ['a', 'b', 'c', 'd'] c = my_func()[2] print(c) # ๐Ÿ‘‰๏ธ 'c' d = my_func()[3] print(d) # ๐Ÿ‘‰๏ธ 'd' c, d = my_func()[2:4] print(c) # ๐Ÿ‘‰๏ธ ...
๐ŸŒ
Python Basics
pythonbasics.org โ€บ multiple-return
Multiple return - Python Tutorial
Call the function with complexfunction(2,3) and its output can be used or saved. But what if you have multiple variables in a function that you want access to? Create a function getPerson(). As you already know a function can return a single variable, but it can also return multiple variables.
๐ŸŒ
datagy
datagy.io โ€บ home โ€บ python posts โ€บ python: return multiple values from a function
Python: Return Multiple Values from a Function โ€ข datagy
December 19, 2022 - In the example above, we have defined ... return_one() and return_two(). The former of these returns only a single value. Meanwhile, the latter function, return_two(), returns two values.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ returning-multiple-values-in-python
Returning Multiple Values in Python?
Another option is to use class, ... result = [x + 1] result.append(x * 3) result.append(y0 ** 3) return result ยท We can opt this option of using the yield to return multiple values one by one, in case we have to return a hunge number of values then using sequences may ...
๐ŸŒ
Medium
martinxpn.medium.com โ€บ what-are-multiple-return-values-actually-in-python-28-100-days-of-python-82821c8de24b
What are Multiple Return Values Actually in Python? (28/100 Days of Python) | by Martin Mirakyan | Medium
April 10, 2023 - Thus making it possible to write ... age, id) # Got the user data: Anna 23 anna123 ยท Yet, in reality, the language actually allows only a single return value....
Top answer
1 of 14
697

Named tuples were added in 2.6 for this purpose. Also see os.stat for a similar builtin example.

>>> import collections
>>> Point = collections.namedtuple('Point', ['x', 'y'])
>>> p = Point(1, y=2)
>>> p.x, p.y
1 2
>>> p[0], p[1]
1 2

In recent versions of Python 3 (3.6+, I think), the new typing library got the NamedTuple class to make named tuples easier to create and more powerful. Inheriting from typing.NamedTuple lets you use docstrings, default values, and type annotations.

Example (From the docs):

class Employee(NamedTuple):  # inherit from typing.NamedTuple
    name: str
    id: int = 3  # default value

employee = Employee('Guido')
assert employee.id == 3
2 of 14
270

For small projects I find it easiest to work with tuples. When that gets too hard to manage (and not before) I start grouping things into logical structures, however I think your suggested use of dictionaries and ReturnValue objects is wrong (or too simplistic).

Returning a dictionary with keys "y0", "y1", "y2", etc. doesn't offer any advantage over tuples. Returning a ReturnValue instance with properties .y0, .y1, .y2, etc. doesn't offer any advantage over tuples either. You need to start naming things if you want to get anywhere, and you can do that using tuples anyway:

def get_image_data(filename):
    [snip]
    return size, (format, version, compression), (width,height)

size, type, dimensions = get_image_data(x)

IMHO, the only good technique beyond tuples is to return real objects with proper methods and properties, like you get from re.match() or open(file).

๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 2184800 โ€บ can-a-function-in-python-return-multiple-values
Can a function in Python return multiple values? | Sololearn: Learn to code for FREE!
... Hello, no it is not possible. Only 1 value. So you must rely on tuples etc. ... Yeild generator does help you return every iteration value from loop in a function.. ... How many time is necessary to learn Python?
๐ŸŒ
Linux Hint
linuxhint.com โ€บ return_multiple_values_python_function
Return Multiple Values from A Python Function โ€“ Linux Hint
Here, the tupleFunc() function is used to take four input values from the user and return the values as a tuple to the caller. The return values will be stored in a tuple variable named tupleVar and the values will be printed later. #!/usr/bin/env python3 # Define function to return multiple ...