Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python flatten list

l = [[1, 2], [3, 4], [5, 6, 7]]
flat_list = [item for sublist in l for item in sublist]
# flat_list = [1, 2, 3, 4, 5, 6, 7]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #flatten #list
ADD COMMENT
Topic
Name
9+2 =