Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert 2d list to 1d python

import itertools

a = [[1, 2], [3, 4], [5, 6]]
list(itertools.chain.from_iterable(a))

Output:- [1, 2, 3, 4, 5, 6]
 
PREVIOUS NEXT
Tagged: #convert #list #python
ADD COMMENT
Topic
Name
7+9 =