Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python comprehension nested lists

>>> A=[[1,2,3], [4,5,6], [7,8] , [9,10]] # A is a list of lists
>>> [x for y in A for x in y] # dissolves the inner brackets
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> 
 
PREVIOUS NEXT
Tagged: #python #comprehension #nested #lists
ADD COMMENT
Topic
Name
5+5 =