user1741339 user1741339 - 9 months ago 65
Python Question

flatten list in python

I want to flatten the list:

exampleArray = [[[151.68694121866872]],


[151.68694121866872, 101.59534468349297, 72.16055999176308]

Right now I am doing this:

resultArray= list(chain.from_iterable(list(chain.from_iterable(exampleArray))))

Even though it works I wanted to know if there's a better way.


How about

result = [x[0][0] for x in exampleArray]