1# Python convert 2D into 1D array:
2
3import itertools
4x = [['foo'], ['bar', 'baz'], ['quux'], ("tup_1", "tup_2"), {1:"one", 2:"two"}]
5print list(itertools.chain(*x))
6print [element for sub in x for element in sub]
7
8# Output:
9
10['foo', 'bar', 'baz', 'quux', 'tup_1', 'tup_2', 1, 2]
11
12