The two nested loop for a written list of Formula
e.g., a nested list, a = [[1,2], [3,4], [5,6]],
To extract every element of the list
Loop processing for:
for i in a:
for j in i:
print(j)
Formula list by:
b=[j for i in a for j in i] #注意两个for的顺序
print(b)
>>> b
[1, 2, 3, 4, 5, 6]