[Tutor] Returning multiple objects from a function
Walter Prins
wprins at gmail.com
Tue Jul 3 01:11:00 CEST 2012
On 2 July 2012 23:55, Alexander Q. <redacted@example.com> wrote:
> Hello- I'm wondering how to access specific objects returned from a function
> when that function returns multiple objects.
>
> For example, if I have "return(list1, list2, list 3)" within a function
When you have:
return (list1, list2, list3)
... you're actually returning a single tuple object. Read about
tuples in the documentation. To access an item from a tuple you index
into it, e.g.
tupleresult = myfunc()
x = tupleresult[0]
... for example
Walter.
More information about the Tutor
mailing list
l>