问答详情
源自:9-2 索引迭代

考虑使用zip()函数和range()函数

L = ['Adam', 'Lisa', 'Bart', 'Paul']

for index, name in zip([1,2,3,4],L):

    print index, '-', name


提问者:caiweipan 2015-08-03 09:28

个回答

  • anber
    2015-12-22 18:06:59

    确实可以,但是 多消耗了一个list的空间