Last active
December 31, 2015 17:59
-
-
Save otknoy/8024098 to your computer and use it in GitHub Desktop.
Python で flatten
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
from itertools import chain | |
l = [[1, 2, 3], [4, 5], [6, 7, 8, 9]] | |
all_doc = list(chain.from_iterable(l)) | |
# こんなのもある | |
sum(l, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment