make list one dimensional python code example
Example: python convert two dimensional list to one dimensional
# Python convert 2D into 1D array:
import itertools
x = [['foo'], ['bar', 'baz'], ['quux'], ("tup_1", "tup_2"), {1:"one", 2:"two"}]
print list(itertools.chain(*x))
print [element for sub in x for element in sub]
# Output:
['foo', 'bar', 'baz', 'quux', 'tup_1', 'tup_2', 1, 2]