Skip to content

Instantly share code, notes, and snippets.

@eyaltrabelsi
Created June 21, 2019 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyaltrabelsi/f4d5ca167e95320cef7a1c0b3f71cf82 to your computer and use it in GitHub Desktop.
Save eyaltrabelsi/f4d5ca167e95320cef7a1c0b3f71cf82 to your computer and use it in GitHub Desktop.
Python-tricks flattening lists with itertools
>>> 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