unpacking vars from list of tuples

Wolfram Hinderer wolfram.hinderer at googlemail.com
Wed Sep 16 00:26:41 CEST 2009

On 15 Sep., 23:51, Ross <ros... at gmail.com> wrote:

> If I have a list of tuples:
>    k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")]
> and I want to pull the middle element out of each tuple to make a new
> list:
> myList = ["bob", "joe", "mary"]

if a tuple is OK: zip(*k)[1]

More information about the Python-list mailing list