Python集合list遍历

list1=['ta',11,"fewfe",[33,'ewe']];
#方法一
for i in list1:
    print i;
ta
11
fewfe
[33, 'ewe']

#方法二
for i in range(0,len(list1)):
    print list1[i];
ta
11
fewfe
[33, 'ewe']

#方法三
for i,ivalue in enumerate(list1):
    print i, ivalue
0 ta
1 11
2 fewfe
3 [33, 'ewe']




你可能感兴趣的:(Python)