join list of lists in python
python
Solution
import itertools
a = [['a','b'], ['c']]
print(list(itertools.chain.from_iterable(a)))
This gives
['a', 'b', 'c']
Problem
Is the a short syntax for joining a list of lists into a single list( or iterator) in python? For example I have a list as follows and I want to iterate over a,b and c. ``` x = [["a","b"], ["c"]] ``` The best I can come up with is as follows. ``` result = [] [ result.extend(el) for el in x] for el in result: print el ```