hassek

Remember

My code snippets

To flatten a list in a simple way we can use the operator.concat and a reduce function.

In [1]: import operator

In [2]: my_list = [[1, 2], [3, 4, 5]]

In [3]: print reduce(operator.concat, my_list)
[1, 2, 3, 4, 5]