Answers for "double for loop python one line"

15

one-line for loop python

[thing for thing in list_of_things]
Posted by: Guest on March-17-2020
0

double for in loop python

#code to print all atomic members of a list into a single list
#eg convert [[1,2,3], [4,5,6], [7,8,9,10]] to 
l0 = [[1,2,3], [4,5,6], [7,8,9,10]]

flat = [l2 for l1 in l0 for l2 in l1]
#prints out:
#[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Posted by: Guest on January-03-2022

Code answers related to "double for loop python one line"

Python Answers by Framework

Browse Popular Code Answers by Language