Class = ["Gabriel","Isabella","Veronica","Hunter","John"]
num = [1,2,3,4,5]
for i in num :
for z in Class :
print "%d. %s"%(i,z)
上面是打印这个:
1. Gabriel 1. Isabella 1. Veronica 1. Hunter 1. John 2. Gabriel 2. Isabella 2. Veronica 2. Hunter 2. John 3. Gabriel 3. Isabella 3. Veronica 3. Hunter 3. John 4. Gabriel 4. Isabella 4. Veronica 4. Hunter 4. John 5. Gabriel 5. Isabella 5. Veronica 5. Hunter 5. John
我希望每次只有这样一次:
- 加布里埃尔
- 洛
- 婆婆纳
- 亨特
- 约翰
醇>
答案 0 :(得分:1)
for i,z in zip(num, Class):
print "%d. %s"%(i,z)