In particular I am looking if there is some cartesian_product() method built into python or a way to do this with itertools avoid having to write a nested multidimension loop.
for example I have the following
input = [
[1],
[[2]],
[3],
[[a,b,c] , [[z,x,y]] , [d,f,g]],
4
]
expecting:
output = [
[1,2,3,a,b,c,4]
[1,2,3,z,x,y,4]
[1,2,3,d,f,g,4]
]
The one particular challenge is that as in the above input list, an item can have any layer of lists, but it should be able to ignore all of those and still produce a flattened result.