Python convert tuple to array
Question: How can I convert at 3-Dimensinal tuple into an array

    
    
    a = []
    a.append((1,2,4))
    a.append((2,3,4))
    

in a array like:

    
    
    b = [1,2,4,2,3,4]
    


Answer: Using [list
comprehension](http://docs.python.org/2/tutorial/datastructures.html#list-
comprehensions):

    
    
    >>> a = []
    >>> a.append((1,2,4))
    >>> a.append((2,3,4))
    >>> [x for xs in a for x in xs]
    [1, 2, 4, 2, 3, 4]
    

Using
[`itertools.chain.from_iterable`](http://docs.python.org/2/library/itertools.html#itertools.chain.from_iterable):

    
    
    >>> import itertools
    >>> list(itertools.chain.from_iterable(a))
    [1, 2, 4, 2, 3, 4]
    

