Hi Amir, and welcome! On Sun, 7 Jun 2015 02:38 am, 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,... ) That's actually wrong. If you run: data = func(5) data does NOT equal the tuple (10, 15, ...) but it is a generator object. Iterating over the generator will yield 10, 15 etc one item at a time. Please remember that the Original Poster is a beginner. He is having trouble with *basic* Python questions, like returning multiple items from a single function call. Showing him advanced techniques like generators, especially when the example you show is wrong, will just confuse him more. -- Steven -- https://mail.python.org/mailman/listinfo/python-list