The zip() function outputs the tuple. How can I get the list instead of the tuple?
E.g.
>>> a=[1,3,5,7]>>> b=[2,4,6,8]>>> zip(a,b)[(1, 2), (3, 4), (5, 6), (7, 8)]
>>> a=[1,3,5,7]
>>> b=[2,4,6,8]
>>> zip(a,b)
[(1, 2), (3, 4), (5, 6), (7, 8)]
My desired output is [[1, 2], [3, 4], [5, 6], [7, 8]]
You can use map() function to convert tuple to list. Check this example:
>>> a=[1,3,5,7]>>> b=[2,4,6,8]>>> zip(a,b)[(1, 2), (3, 4), (5, 6), (7, 8)]>>> map(list, zip(a,b))[[1, 2], [3, 4], [5, 6], [7, 8]]