1flat_list = [item for sublist in l for item in sublist]
2
3#which is equivalent to this
4flat_list = []
5for sublist in l:
6 for item in sublist:
7 flat_list.append(item)
1# idiomatic python
2
3# using itertools
4import itertools
5
6list_of_list = [[1, 2, 3], [4, 5], [6]]
7chain = itertools.chain(*images)
8
9flattened_list = list(chain)
10# [1, 2, 3, 4, 5, 6]