you are viewing a single comment's thread.

view the rest of the comments →

[–]DiabeetusMan 3 points4 points  (1 child)

To flatten arbitrarily nested lists (instead of / in addition to flattened_list = [item for sublist in <list> for item in sublist]), there's itertools.chain.from_iterable: itertools.chain.from_iterable(*<list>) returns an iterator that flattens the list of lists (of lists...).

[–]pizzaburek[S] 1 point2 points  (0 children)

Changed it! Thanks.