Created
June 21, 2019 07:14
-
-
Save eyaltrabelsi/f4d5ca167e95320cef7a1c0b3f71cf82 to your computer and use it in GitHub Desktop.
Python-tricks flattening lists with itertools
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
>>> a = [[1, 2], [3, 4], [5, 6]] | |
>>> list(itertools.chain.from_iterable(a)) | |
[1, 2, 3, 4, 5, 6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment