I have a list of lists
big_list = [[\'a1\',\'b1\',\'c1\'], [\'a2\',\'b2\',\'c3\'], [\'a3\',\'b3\',\'c3\']]
how do I zip the lists within th
Use the *args
argument expansion syntax:
zip(*big_list)
The *
(splash) tells Python to take each element in an iterable and apply it as a separate argument to the function.
Demo:
>>> big_list = [['a1','b1','c1'], ['a2','b2','c3'], ['a3','b3','c3']]
>>> zip(*big_list)
[('a1', 'a2', 'a3'), ('b1', 'b2', 'b3'), ('c1', 'c3', 'c3')]