# Animation Nodes: How to unzip a list

While searching for an answer for this question here Exponential replication of object, I came across an issue which I think should be easy to solve, but somehow I'm either blocked or stubborn. I've created a nested list, which according to the Debug Output looks something like this:

[[(0,0,1), (0,0,2)], [(1,0,1), (1,0,2),....]]


So, format-wise it is a Generic List surrounding a bunch of Vector Lists. How can I unzip it (that's what it's called in Sverchok), meaning to get this:

[(0,0,1), (0,0,2), (1,0,1), (1,0,2),....]


Any help appreciated!

I'd suggest to use an expression or script node for that. Although an expression should be all you need. Only in case you need to do this in multiple places you should use a script node maybe.

a = [[(0,0,1), (0,0,2)], [(1,0,1), (1,0,2)]]

# long version (for script node maybe)
result = []
for sublist in a:
result.extend(sublist)

# shorter version (single expression, can be used in the Expression node)
import itertools
result = list(itertools.chain.from_iterable(a))

# you can also use a nested list comprehension
result = [vector for vector in sublist for sublist in a]


To use itertools in the expression node you need to write that into the advanced node settings: