enumerate is one of python's built-in functions, which is mainly used to obtain the index and element of an iterable object.
例子1:for i, n in enumerate(list):
print(i,n)
Can also be used to read the line count of a file:
Example 2: count = 0
for i, n in enumerate(open(file,'r')):
count += 1
print(count)