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