itertools.product() return value
list, python, tuples
Solution
list(map(list, product([1, 2, 3], ['a', 'b'])))
The outermost `list()` is not necessary on Python 2, though it is for Python 3. That is because in Python 3 a `map object` is returned by `map()`.
Problem
When I tried running the following code ``` product([1,2,3],['a','b']) ``` it returned an object of the following type: ``` <itertools.product object at 0x01E76D78> ``` Then I tried calling list() on it and I got the following: ``` [(1, 'a'), (1, 'b'), (2, 'a'), (2, 'b'), (3, 'a'), (3, 'b')] ``` Is there any way to make it into a list of lists, instead of tuples? Like this: ``` [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b'], [3, 'a'], [3, 'b']] ``` Thanks in advance!