Skip to content

Instantly share code, notes, and snippets.

@userddssilva
Last active February 3, 2021 13:22
Show Gist options
  • Save userddssilva/1575fa8ebaaad5e6218492b559ba7f0c to your computer and use it in GitHub Desktop.
Save userddssilva/1575fa8ebaaad5e6218492b559ba7f0c to your computer and use it in GitHub Desktop.
How to make a flat list out of list of lists?
import itertools
list2d = [[1,2,3], [4,5,6], [7], [8,9]]
merged = list(itertools.chain.from_iterable(list2d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment