I was trying to use the product() function in Python. I know product() takes a bunch of iterables and does the Cartesian product of all of them.
Now I put all the iterables in a list. I’m wondering how to pass all the iterables in that list at once? I can’t pass in the list to product directly because then product()’ll treat it as one iterable.
For example, I have a list of lists:
[[1,2,3],['a','b']]
How can I pass [1,2,3] and [‘a’,’b’] to product, so it becomes equivalent to product([1,2,3],[‘a’,’b’])?
Thanks in advance!
This is called Unpacking argument lists.