The enumerate dictionary is an enumeration, enumerated meaning.
The keyword enum in the C language is also an abbreviation for enumerate. In Python, the Enumerate method returns a enumerate type. Parameters are generally things that can be traversed, such as a list, a string, or something. This is said in the Python document: Enumerate (sequence, [start=0]) Return an enumerate object. Sequence must is a sequence, an iterator, or some other object which sup-ports iteration. The next () method of the iterator returned by enumerate () returns a tuple Containinga count (from start which defaults to 0) and the corresponding value obtained from iterating through iter-able. Enumerate () is useful for obtaining an indexed series: (0, Seq[0]), (1, seq[1]), (2,seq[2]), .... For example:>>> for me, season in enumerate ([' Spring ', ' Summer ', ' Fall ', ' Winter ']): ... print i, Season0 Spring1 S Ummer2 Fall3 Winter I tried it, if the loop was changed to season in [' Spring ', ' Summer ', ' Fall ', ' Winter ']: Actually, it's OK, but enumerate will return an indexed thing, That I, that I, starting from 0, each plus one.
Python Enumerate function usage