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]
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
I think the following confuses our friend senateboy
print "hot", "dog" # -> hot dog
str1 = "hot", "dog"
print str1 # -> ('hot', 'dog')
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417