# coding:utf-8
lst=['hello','world','python','php']
#使用便利循环for,遍历列表元素
for item in lst:
print(item)
#使用for循环,range(),len(),根据索引遍历
for i in range(len(lst)):
print(i,'--->',lst[i])
#使用for循环与enumerate()函数遍历列表
for index,item in enumerate(lst,1):
print(index,item)
注解:enumerate(lst,n) lst为列表,n为序号开始值。