"".join(list) if list contains a nested list in python?
Question: I know that `"".join(list)` converts the list to a string, but what if that
list contains a nested list? When I try it returns a `TypeError` due to
unexpected list type. I'm guessing it's possible with error handling, but so
far my attempts have been fruitless.


Answer: Well, if the list is nested, simply
[flatten](http://stackoverflow.com/questions/406121/flattening-a-shallow-list-
in-python) it beforehand:

    
    
    >>> import itertools
    >>> lst = [['a', 'b'], ['c', 'd']]
    >>> ''.join(itertools.chain(*lst))
    'abcd'
    

