10

For example, if I have

a=[['a','b','c'],[1,2,3],['d','e','f'],[4,5,6]]

How can I get each element of a to be an argument of say, zip without having to type

zip(a[0],a[1],a[2],a[3])?

JonC
  • 277
  • 1
  • 4
  • 18

2 Answers2

25

Using sequence unpacking (thanks to delnan for the name):

zip(*a)
Joe D
  • 2,855
  • 2
  • 31
  • 25
-1

Chain()?

http://docs.python.org/library/itertools.html#itertools.chain

nm, read it wrong. That won't work.

Matt_JD
  • 566
  • 6
  • 16