I'm trying to figure out how this list comprehension works, but I can't quite understand how it works. If somebody could write the non-list-comprehension equivalent I think I could understand.
This is the line I'm stuck on:
[item for sublist in li for item in sublist]
It's stated purpose is to flatted out multidimensional lists. Here's an example of me testing it:
>>> li = [[0,1],[1,3,5],[4,5,3,2]]
>>> [item for sublist in li for item in sublist]
[0, 1, 1, 3, 5, 4, 5, 3, 2]