On Fri, Dec 30, 2016 at 2:58 PM, Joaquin Alzola <joaquin.alz...@lebara.com> wrote: > > >>Now, this puzzles me: > >>>>> [x,y for a in data] >> File "<stdin>", line 1 >> [x,y for a in data] > > ^ >>SyntaxError: invalid syntax > >>I expected: >>[(1, 2), (3, 4)] > > You can try [(x,z) for x,z in data]. > In your situation a takes the values (1,2) or (3,4) in the one that I put x > and z take the tupple values (x first one z second one). > >>>> [(x,z) for x,z in data] > [(1, 2), (3, 4)]
I like yours better than mine. -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays -- https://mail.python.org/mailman/listinfo/python-list