I recently looked for a way to flatten a nested python list, like this: [[1,2,3],[4,5,6]], into this: [1,2,3,4,5,6].
Stackoverflow was helpful as ever and I found a
For the lazy dev that wants a quick answer:
>>> a = [[1,2], [3,4]] >>> [i for g in a for i in g] [1, 2, 3, 4]