Transform "list of tuples" into a flat list or a matrix
list, python, tuples
Solution
By far the fastest (and shortest) solution posted:
list(sum(output, ()))
About 50% faster than the `itertools` solution, and about 70% faster than the `map` solution.
Problem
With Sqlite, a `select .. from` command returns the results `output`, which prints: ``` >>print output [(12.2817, 12.2817), (0, 0), (8.52, 8.52)] ``` It seems to be a list of tuples. I would like to either convert `output` to a simple list: ``` [12.2817, 12.2817, 0, 0, 8.52, 8.52] ``` or a 2x3 matrix: ``` 12.2817 12.2817 0 0 8.52 8.52 ``` to be read via `output[i][j]` The flatten command does not do the job for the 1st option, and I have no idea for the second one... A fast solution would be appreciated, as the real data is much bigger.