fork(1) download
  1. from itertools import product
  2.  
  3. def gen(l):
  4. return product(*map(range, l))
  5.  
  6. print(list(gen([1, 2, 3])))
Success #stdin #stdout 0.02s 9936KB
stdin
Standard input is empty
stdout
[(0, 0, 0), (0, 0, 1), (0, 0, 2), (0, 1, 0), (0, 1, 1), (0, 1, 2)]