Flattening a nested sequence
>>> a = [[1, 2, 3], [4, 5, 6]] >>> b = [i for j in a for i in j] # [1, 2, 3, 4, 5, 6]