>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)]
This email is confidential and may be subject to privilege. If you are not the 
intended recipient, please do not copy or disclose its content but contact the 
sender immediately upon receipt.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to