enumerate用法

Posted whitesky_root

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了enumerate用法相关的知识,希望对你有一定的参考价值。

  

Return an enumerate object. sequence must be a sequence, an iterator, or some other object which sup-
ports iteration. The next() method of the iterator returned by enumerate() returns a tuple containing
a count (from start which defaults to 0) and the corresponding value obtained from iterating over iter-
able. enumerate() is useful for obtaining an indexed series: (0, seq[0]), (1, seq[1]), (2,
seq[2]), .... 
 
For example:
>>> for i, season in enumerate([’Spring’, ’Summer’, ’Fall’, ’Winter’]):
...
 print i, season
0 Spring
1 Summer
2 Fall
3 Winter

以上是关于enumerate用法的主要内容,如果未能解决你的问题,请参考以下文章

python enumerate 用法

python enumerate用法

python enumerate用法总结

python enumerate用法总结

python enumerate用法总结

python enumerate用法总结(转)