Though i found answer to this in the below link, i want to know how to achieve this using itertools in python. combinations using n arrays by selecting one element from each
Asked
Active
Viewed 270 times
1 Answers
0
import itertools
A = [[1], [2,3,4], [5]]
result = []
for c in itertools.product(*A):
result.append(list(c))
print(result)
Reference: https://docs.python.org/3/library/itertools.html#itertools.product

tenacity
- 456
- 1
- 5
- 14