6
有沒有一種巧妙的方式來迭代兩個列表中的Python(不使用列表理解)?Python多列表迭代
我的意思是,像這樣的:
# (a, b) is the cartesian product between the two lists' elements
for a, b in list1, list2:
foo(a, b)
代替:
for a in list1:
for b in list2:
foo(a, b)