Maybe this example from the "Starting Python" sticky will help ...
[php]
# use a tuple to return multiple items from a function
# a tuple is a set of values separated by commas
def multiReturn():
return 3.14, "frivolous lawsuits", "Good 'N' Plenty"
# show the returned tuple
# notice that it is enclosed in ()
print multiReturn()
# load to a tuple of variables
num, str1, str2 = multiReturn()
print num
print str1
print str2
# or pick just the element at index 1, should be same as str1
# tuples start at index zero just like lists etc.
print multiReturn()[1]
[/php]
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
Offline 5,792 posts
since Oct 2004