Python Iterate through list of list to make a new list in index sequence
Question: How would you iterate through a list of lists, such as:

    
    
    [[1,2,3,4], [5,6], [7,8,9]]
    

and construct a new list by grabbing the first item of each list, then the
second, etc. So the above becomes this:

    
    
    [1, 5, 7, 2, 6, 8, 3, 9, 4]
    


Answer: You can use a list comprehension along with
[`itertools.izip_longest`](https://docs.python.org/2/library/itertools.html#itertools.izip_longest)
(or `zip_longest` in Python 3)

    
    
    from itertools import izip_longest
    a = [[1,2,3,4], [5,6], [7,8,9]]
    [i for sublist in izip_longest(*a) for i in sublist if i is not None]
    # [1, 5, 7, 2, 6, 8, 3, 9, 4]
    

