enumerate
(iterable, start=0)
Return an enumerate object. iterable must be a sequence, an iterator, or some other object which supports iteration. The __next__() method of the iterator returned by enumerate() returns a tuple containing a count (from start which defaults to 0) and the values obtained from iterating over iterable.
enumerate() 函数用于将一个可遍历的数据对象(如列表、元组或字符串)组合为一个索引序列,同时列出数据和数据下标,一般用在 for 循环当中。
以下是 enumerate() 方法的语法:
参数
- sequence -- 一个序列、迭代器或其他支持迭代对象。
- start -- 下标起始位置的值。
返回值
返回 enumerate(枚举) 对象。
Equivalent to:
https://www.runoob.com/python/python-func-enumerate.html