By iterative sequence index python

Further traversing the way through the execution cycle index, the following examples:

#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
fruits = ['banana', 'apple',  'mango']
for index in range(len(fruits)):
   print '当前水果 :', fruits[index]
 
print "Good bye!"

 The above examples we use the built-len () function and Range (), len () function returns the length of the list, i.e. the number of elements. range returns a sequence number.

Guess you like

Origin www.cnblogs.com/furuihua/p/11233193.html