返回顶部

收藏

Loop over two or more sequences at the same time

更多
# Loop over two or more sequences at the same time, 
# the entries can be paired with the zip() function.

questions = ['A', 'B', 'C']
answers = ['a', 'b', 'c']

for q, a in zip(questions, answers):
     print 'What is your %s?  It is %s.' % (q, a)

标签:Python,Buildin,Function

收藏

0人收藏

支持

0

反对

0