return multiple values from fuction
Jay Dorsey
jay at jaydorsey.com
Thu Nov 6 13:23:49 EST 2003
Lupe wrote:
> hi, if someone can help me I would be grateful
>
> when I do
>
> def function
> kjklj
> llklç
>
> return variableA, variableB
>
> how can I assign the two return values to two distinct variables, as for ex.
>
> varC = variableA
> varD = variableB
>
>>> def a():
... return "value 1", "value 2"
...
>>> c, d = a()
>>> c
'value 1'
>>> d
'value 2'
>>> e = a()
>>> e
('value 1', 'value 2')
HTH
Jay
More information about the Python-list
mailing list