python的enumerate函数用于循环索引和元素

  例如

  

 foo = 'abc'
 for i , ch in enumerate(foo):
	print ch, '(%d)' % i

输出结果:	
a (0)
b (1)
c (2)

 

相关文章: