flatten out a list python code example
Example 1: flatten list of lists python
flat_list = [item for sublist in t for item in sublist]
Example 2: python flatten list
l = [[1, 2], [3, 4], [5, 6, 7]]
flat_list = [item for sublist in l for item in sublist]
# flat_list = [1, 2, 3, 4, 5, 6, 7]