On Saturday, June 6, 2015 at 11:27:29 PM UTC+5:30, fl wrote: > On Saturday, June 6, 2015 at 9:39:19 AM UTC-7, Amir Arsalan wrote: > > you can use yield structure in python for multiple return. ex: > > > > > > def func(a): > > yield a*2 > > print "a*2" > > yield a*3 > > print "a*3" > > ... > > > > > > data = func(5) --> data = (10,15,... ) > > > > > > On Wed, Jun 3, 2015 at 1:57 AM, fl wrote: > > Hi, > > > > > > > > I just see the tutorial says Python can return value in function, it does > > > > not say multiple data results return situation. In C, it is possible. > > > > How about Python on a multiple data return requirement? > > > > > > > > > > > > Thanks, > > > > -- > > > > https://mail.python.org/mailman/listinfo/python-list > > Excuse me. I input the following according to your idea, but I do not > understand how to use it from the echo. It does not show how to use > the multiple output results. I am a new Python user. Please give a little > more explanation if you could.
You still have this question? Ok apologies for our long rambles far from your question. But Joel Goldstick gave right at the start a neat and complete answer. I repeat it with the tuples made more explicit def my_function(n): return (n, n*2) # return multiple vals as tuple # somewhere, sometime else (a_number, its_double) = my_function(3) # receive the tuple Is there something about it that you dont understand or find unsatisfactory? -- https://mail.python.org/mailman/listinfo/python-list