Last active
February 3, 2021 13:22
-
-
Save userddssilva/1575fa8ebaaad5e6218492b559ba7f0c to your computer and use it in GitHub Desktop.
How to make a flat list out of list of lists?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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