Can Python function return multiple data?

Amir Arsalan am1r.ar3alan at gmail.com
Sat Jun 6 12:38:57 EDT 2015


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 <rxjwg98 at gmail.com> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150606/be6b33cf/attachment.html>


More information about the Python-list mailing list