1.列表 list
a = ['a','b','c','d','e','f'] 1.1 for i in a: print(i) 1.2 for i in range(len(a)): print(i,a[i]) 1.3 for i,ele in enumerate(a): print(i,ele)
2.字典 dict
vdic = {'name':'jack','age':18,'city':'beijin','height':180}
2.1
for key in vdic: print(key+':'+vdic[key])
2.2
for key in vdic.values():
print(key+':'+vdic[key])
2.3
for k,v in vdic.items():
print(k,v)
3.tuple遍历跟list一样