1、enumerate可添加list的indicies:
animals = [‘cat‘, ‘dog‘, ‘monkey‘] for idx, animal in enumerate(animals): print(‘#%d: %s‘ % (idx + 1, animal))
python记录贴
原文:http://www.cnblogs.com/dumbbirds/p/7581013.html