If I have a list of tuples a = [(1,2), (3,4), (5,6)], and I want to return a new list of each individual element in these tuples, I can do it with a nested for loop but when I try to do it using the list comprehension b = [j for j in i for i in a], my output is b = [5,5,5,6,6,6] instead of the correct b = [1,2,3,4,5,6]. What am I doing wrong? -- http://mail.python.org/mailman/listinfo/python-list
- list comprehension question Ross
- Re: list comprehension question Chris Rebert
- Re: list comprehension question Shane Geiger
- Re: Re: list comprehension question John Posner
- Re: Re: list comprehension question J. Cliff Dyer
- Re: list comprehension question Steven D'Aprano
- Re: list comprehension question Terry Reedy
- Re: list comprehension question Scott David Daniels
- Re: list comprehension question Lie Ryan
- Re: list comprehension question Michael Spencer
- Re: list comprehension question Arnaud Delobelle