1. zip模式
x = ['a','b','c']
y = [1,2,3]
for i,j in zip(x,y):
print(i,j)
输出
a 1
b 2
c 3
2. product模式
from itertools import product
lst = [1,2,3]
for i,j,k in product(lst,lst,lst):
print(i,j,k)
输出(27组):
1 1 1
1 1 2
1 1 3
1 2 1
...
3 3 3
网友评论